wonderivan / logger Goto Github PK
View Code? Open in Web Editor NEWgolang日志处理包
golang日志处理包
你好,请问打印错误信息时,如何设置不显示文件路径
2019-11-09 17:33:01 [EROR] [/Volumes/1/works/LuBan/install/utils.go:196] [globals] read file err is : open /root/.ssh/id_rsa: no such file or directory
2019-11-09 17:33:01 [EROR] [/Volumes/1/works/LuBan/install/utils.go:102] [1]Error create ssh s
日志级别单词完整拼写ERROR 。。。
win power shell 不显示颜色问题
log1 := logger.NewLogger()
log2 := logger.NewLogger()
log1.SetLogger("file", "{"filename":"log1.log"}")
log2.SetLogger("file", "{"filename":"log2.log"}")
log1.Info("log1")
log2.Info("log2")
此时log1,log2都将输出到log2.log
原因是
var adapters = make(map[string]Logger)
调用Register时传入的是指针,SetLogger中logger, ok := adapters[adapterName],就会修改adapters
只会有一个file适配器生效
(1)Dial如果网络超时,DialTimeout
(2)选项,输出日志是否到终端,如果日志文件可以选择不输出到终端
(3)分日志文件打印,一般Notice为了日志统计使用的,选择日志级别,打印到某个文件,其他的打印到一个文件。
日志内有没有行数开关
是否支持协程内日志输出?
文档中“当前日志输出等级共8种,从0-7对应的等级由高到底,当配置为某个输出等级时,只有大于等于该等级的日志才会输出。”
实际使用中发现当小于等于设置的等级日志才会输出到file中,不知道是否是使用方法有误。
刚进入go,谢谢造的轮子
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.