Skip to content
/ log Public

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

Notifications You must be signed in to change notification settings

mywrap/log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Packages

No packages published