Go logger
golog - Logger
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.
For examples visit godoc#pkg-examples
For GoDoc reference, visit pkg.go.dev
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"))
}
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"))
}
This package is released under the MIT license. See the complete license in the package