Skip to content

vardius/golog

📟 golog

Build Status Go Report Card codecov license

logo

golog - Logger

📖 ABOUT

Contributors:

Want to contribute ? Feel free to send pull requests!

Have problems, bugs, feature ideas? We are using the github issue tracker to manage them.

📚 Documentation

For examples visit godoc#pkg-examples

For GoDoc reference, visit pkg.go.dev

🚏 HOW TO USE

🏫 Basic example

package main

import (
    "fmt"
    "context"
    
    "github.com/vardius/golog"
)

func main() {
    ctx := context.Background()
    logger := golog.New()
    
    logger.Debug(ctx context.Context, fmt.Sprintf("Hello %s!", "you"))
}

📦 As a package

package mylogger

import (
    "context"
    
    "github.com/vardius/golog"
)

var Logger golog.Logger

func SetFlags(flag int) {
    Logger.SetFlags(flag)
}

func SetVerbosity(verbosity golog.Verbose) {
    Logger.SetVerbosity(verbosity)
}

func Debug(ctx context.Context, v string) {
    Logger.Debug(ctx, v)
}

func Info(ctx context.Context, v string) {
    Logger.Info(ctx, v)
}

func Warning(ctx context.Context, v string) {
    Logger.Warning(ctx, v)
}

func Error(ctx context.Context, v string) {
    Logger.Error(ctx, v)
}

func Critical(ctx context.Context, v string) {
	Logger.Critical(ctx, v)
}

func Fatal(ctx context.Context, v string) {
	Logger.Fatal(ctx, v)
}

func init() {
    Logger = golog.New()
}

usage:

package main

import (
    "fmt"
    
    "mylogger"
)

func main() {
    mylogger.Debug(ctx context.Context, fmt.Sprintf("Hello %s!", "you"))
}

📜 License

This package is released under the MIT license. See the complete license in the package

About

Go logger

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages