README ¶ log log 目前最低级别是 debug,可以通过 LOG_LEVEL 环境变量或者配置项指定。 log 会记录上下文信息息,所以需要传入一个 ctx 才能获取 log 实例。 示例 import "github.com/busyfree/leaf-go/util/log" log.Get(ctx).Errorf("1 + 2 = %d", 1 + 2) Expand ▾ Collapse ▴ Documentation ¶ Overview ¶ Package log 基础日志组件 Index ¶ func PP(args ...interface{}) func Reset() type Fields type Logger func Get(ctx context.Context) Logger Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func PP ¶ func PP(args ...interface{}) PP 类似 PHP 的 var_dump func Reset ¶ func Reset() Reset 使用最新配置重置日志级别 Types ¶ type Fields ¶ type Fields = logrus.Fields Fields fields type Logger ¶ type Logger = *logrus.Entry Logger logger func Get ¶ func Get(ctx context.Context) Logger Get 获取日志实例 Source Files ¶ View all Source files log.go Directories ¶ Show internal Expand all Path Synopsis hooks Click to show internal directories. Click to hide internal directories.