logker
It's a log Library of Golang. It's easy to use.👨💻
📚中文说明 | 🤩Pkg.go.dev | 👨💻 Release
If you want to check the latest updates, please go to this warehouse https://github.com/higker/logker
- Support file backup.
- Simple and easy to use.
- Support file storage log.
- Support console color printing.
- Custom log file storage location.
- Support setting time and time zone.
- Support log file size for split storage.
- Error level output to specified file separately.
- Four levels of
debug
info
error
warning
are supported. Future support: The remote computer stores the websoket output🙏.
The project is constantly maintained and updated. I like 😍A kind of Please click star Thanks♪(・ω・)ノ!
🔝 The minimum requirement of Go version is 1.11. 🔝 Your project also uses go module!!!
go get github.com/higker/logker
OR
go get -u github.com/higker/logker
command add -u
flag to update in the future.
package main
import (
klog "github.com/higker/logker"
"time"
)
func main() {
// Specify file location! Create folder in advance!!
dir := "/Users/ding/Documents/test_log"
// New file logger
// File Max size : You can also use built-in constants
// klog.GB1 = 1GB
// klog.MB10 = 10MB
// klog.MB100 = 100MB
flog := klog.NewFlog(klog.DEBUG, true, klog.Shanghai, dir, "log", 10*1024, 0777)
// Analog output log
for {
flog.Debug("DEBUG : %d + %d = %d",1,2,1+2)
flog.Error("ERROR")
flog.Warning("WARNING %p",flog)
flog.Info("INFO %s","Hello LogKer.")
time.Sleep(2 * time.Second)
}
}
👆Parameter note List:
// Build File logger
// Args note
// logLevel: lev, \\ logging level
// wheError: wheErr, \\ whether enable error alone file
// directory: dir, \\ logging file save directory
// fileName: fileName, \\ logging save file name
// timeZone: zone, \\ load time zone format
// power: power, \\ file system power
// fileMaxSize: size, \\ logging alone file max size
package main
import (
klog "github.com/higker/logker"
"time"
)
func main() {
// New Console logger
clog := klog.NewClog(klog.DEBUG,klog.Shanghai)
clog.Debug("DEBUG : %d + %d = %d",1,2,1+2)
clog.Error("ERROR")
clog.Warning("WARNING %p",clog)
clog.Info("INFO %s","Hello LogKer.")
}
- fatih (https://github.com/fatih/color)
- Icon Mafia (Logo & Banner design)
- When are you? 😜
Welcome to submit work order👏
Pkg Docs:
click to pkg.go.dev
This project open source is MIT License . See the LICENSE file content.