logging

时间:2021-03-12 20:59:55
【文件属性】:
文件名称:logging
文件大小:9KB
文件格式:ZIP
更新时间:2021-03-12 20:59:55
Go 测井 在我所有的项目中都使用 ,我发现自己重复了少量的bootstrap和http中间件。 然后,当我的所有项目都不能与Stackdriver兼容时,我决定为此创建一个小包装: 高度自以为是 兼容Stackdriver 大量使用context.Context 用法: ctx := context . Background () logger := logging . New ( ctx , "myservice" , "example" ) logger . Info ( "hello, world!!" ) ctx = logging . WithLogger ( ctx , logger ) err := someOperation ( ctx ) logger . Error ( "failed" , zap . Error ( err )) (有关在http服务中使用日志
【文件预览】:
logging-main
----go.mod(125B)
----example_test.go(400B)
----go.sum(5KB)
----logger.go(2KB)
----middleware.go(2KB)
----context.go(1KB)
----internal()
--------stackdriver.go(1KB)
----LICENSE(1KB)
----doc.go(246B)
----README.md(912B)
----cmd()
--------example()

网友评论