Logger for production

Use this with to send the logs to Fluentbit.

Usage

package main

import (
	logger "github.com/appneuroncompany/light-logger"
    "github.com/appneuroncompany/light-logger/clogger"
    "errors"
)

func main() {
    logger.Log.App = "App name" // use this on main

    clogger.Error(&map[string]interface{}{ // use it wherever you want
        "smt err: ": errors.New("erors"),
    })

    clogger.Default(&map[string]interface{}{ // use it wherever you want
        "Default message: ": "message",
    })
        
    clogger.Info(&map[string]interface{}{ // use it wherever you want
        "Info message: ": "message",
    })

    clogger.Warning(&map[string]interface{}{ // use it wherever you want
        "Warning message: ": "message",
    })
}

This is how it will look like (will show colorful on linux terminal!):

{
        "level": "ERROR",
        "@timestamp": "2022-04-06 13:24:34",
        "@version": "1",
        "app": "App name",
        "C:/path/to/main.go:13",
        "method": "main",
        "message": {
                "smt err: ": "errors"
        }
}
{
        "level": "DEFAULT",
        "@timestamp": "2022-04-06 13:24:34",
        "@version": "1",
        "app": "App name",
        "line": "C:/path/to/main.go:17",
        "method": "main",
        "message": {
                "Default message: ": "message"
        }
}
{
        "level": "INFO",
        "@timestamp": "2022-04-06 13:24:34",
        "@version": "1",
        "app": "App name",
        "line": "C:/path/to/main.go:21",
        "method": "main",
        "message": {
                "Info message: ": "message"
        }
}
{
        "level": "WARNING",
        "@timestamp": "2022-04-06 13:24:34",
        "@version": "1",
        "app": "App name",
        "line": "C:/path/to/main.go:25",
        "method": "main",
        "message": {
                "Warning message: ": "message"
        }
}

Maintainers

Name Github
Appneuron Comapany appneuroncompany
Burak Halefo─člu burakhalefoglu
Muhammed Sar─▒ muhammeedsari

License

Apache-2.0.

GitHub

View Github