Skip to content

A Golang library for fluent that implements the standard writer io interface.

License

Notifications You must be signed in to change notification settings

gllm-dev/fluentio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fluent IO

A Golang library for fluent that implements the standard writer io interface.

Go Reference Go Report Card

Installation

go get go.gllm.dev/fluentio

Usage

package main

import (
    "fmt"
    "go.gllm.dev/fluentio"
)

func main() {
    // Create a new fluentio.Writer
    f, err := fluentio.New(fluentio.WithBasicConfig("127.0.0.1", 24224, true))
    if err != nil {
        os.Exit(1) 
    }
    
    // Write to fluent
    log := `{"message": "Hello World!"}`
    i, err := f.Write([]byte(log))
    if err != nil {
        os.Exit(1)
    }
    
    fmt.Printf("Wrote %d bytes to fluent", i)  
}

Configuration

The fluentio.Writer can be configured with the following options:

// WithBasicConfig creates a new fluentio.Writer with a basic configuration
fluentio.New(fluentio.WithBasicConfig("127.0.0.1", 24224, true))

// WithFluentConfig creates a new fluentio.Writer with a standard fluent Config
// See github.com/fluent/fluent-logger-golang for more information
fluentio.New(fluentio.WithFluentConfig(fluent.Config{
    FluentPort: 24224,
    FluentHost: "127.0.0.1",
    Async:      true,
    BufferLimit: 1024,
    Timeout:    3 * time.Second,
    // ...
}))

// WithTag sets the tag for the fluentio.Writer
fluentio.New(fluentio.WithTag("my.tag"))

Dependencies

This library depends on the following libraries:

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

A Golang library for fluent that implements the standard writer io interface.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages