Skip to content
mywrapPublic

About

A leveled (info, debug), rotated (time and file size) logger

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

log

A leveled, rotated logger.
Wrapped go.uber.org/zap and natefinch/lumberjack.

Customize logger

This package's top levels log funcs use a global logger that initialized by environment vars or can be configured at runtime with func SetGlobalLoggerConfig.

Default config logs to stdout, log both levels info and debug. If logging to a file (set env LOG_FILE_PATH), the default config will rotate at at midnight in UTC (7AM in Vietnam) or when its size reaches 100MB. Old log files will be delete after 32 days

Usage

package main

import "github.com/mywrap/log"

func main() {
	log.Debugf("line level debug 1+1 = %v", 1+1)
	log.Infof("line level info")
	name := "Dao Thanh Tung"
	log.Printf("hello %v", name)
}

Detail in example.go and log_test.go.

About

A leveled (info, debug), rotated (time and file size) logger

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages