代码拉取完成,页面将自动刷新
package main
import "gitee.com/menciis/logx"
func main() {
logx.Child("Router").Infof("Route %s regirested", "/mypath")
// registerRoute("/mypath")
logx.Child("Router").Warnf("Route %s already exists, skipping second registration", "/mypath")
logx.Error("Something went wrong!")
var (
srvLogger = logx.Child("Server")
app1Logger = srvLogger.Child("App1")
// Or use a pointer as child's key and append the prefix manually:
app2 = newApp("App2")
app2Logger = srvLogger.Child(app2).
SetChildPrefix(app2.Name).
SetLevel("debug")
// Or use a pointer to a value which implements the fmt.Stringer:
app3 = newAppWithString("App3")
app3Logger = srvLogger.Child(app3)
)
srvLogger.Infof("Hello Server")
app1Logger.Infof("Hello App1")
app2Logger.Debugf("Hello App2")
app3Logger.Warnf("Hello App3")
srvLogger.LastChild().Infof("Hello App3 again")
}
type app struct {
Name string
}
func newApp(name string) *app {
return &app{Name: name}
}
type appWithString struct {
name string
}
func newAppWithString(name string) *appWithString {
return &appWithString{name: name}
}
func (app *appWithString) String() string {
return app.name
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。