You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/log
Tony Chen d78eb3ee4b
log: add level printer (#918)
4 years ago
..
README.md log: add level printer (#918) 4 years ago
helper.go log: add level printer (#918) 4 years ago
helper_test.go log: add level printer (#918) 4 years ago
level.go log: rename Print to Log (#886) 4 years ago
log.go log: add level printer (#918) 4 years ago
log_test.go log: add level printer (#918) 4 years ago
std.go log: add level printer (#918) 4 years ago
std_test.go log: add level printer (#918) 4 years ago
value.go log: rename Print to Log (#886) 4 years ago
value_test.go log: add level printer (#918) 4 years ago

README.md

Log

Usage

Structured logging

Logger logger = log.MultiLogger(log.NewStdLogger(os.Stdout), syslog.NewLogger())

logger = log.With(logger,
    "service.name", "hellworld",
    "service.version", "v1.0.0",
    "ts", log.DefaultTimestamp,
    "caller", log.DefaultCaller,
)

logger.Log(log.LevelInfo, "key", "value")

Helper helper = log.NewHelper(logger)
helper.Log(log.LevelInfo, "key", "value")
helper.Info("info message")
helper.Infof("info %s", "message")
helper.Infow("key", "value")