![]() ![]() "nameKey": the label of the logger name in the log entry. "timeKey": the label of the timestamp of the log entry. "levelKey": the label of the level property of the log entry. "messageKey": the label of the message property of the log entry. See docs for go./zap/zapcore/EncoderConfig "encoderConfig": a JSON object which configures advanced encoding settings, like how timestampsĪre formatted. "term" and "term-color" are multi-line, human-friendly Configures how log entries are encoded in the output. "encoding": json, ltsv, term, or term-color. Adds call site information to log entries (file and line). Settings change to be more suitable for developers at a terminal (colorized, multiline, human In development mode, the defaults for the other "levels": A string configuring log levels for specific loggers, overriding the default level. This package does not offer package level log functions, so you need to create a logger instance first:Ī common pattern is to create a single, package-wide logger, named after the package: This is ideal for logging inside libraries, where the log level and output will be managed by Flume is completely silent unless explicitly configured otherwise. The terminal encoders, which are optimized for human viewing, retain multi-lineīy default, all logs are discarded. Thoughtful handling of multi-line log output: Multi-line output is collapsed to a single line, or encoded,ĭepending on the encoder. Levels can be configured via a single string, which is convenient for configuration via env var, see LevelsString()Īll loggers can be reconfigured dynamically at runtime. Supports creating child loggers with pre-set context: Logger.With() Helpers for managing application logs during tests Output can be directed to any writer, defaults to stdout Optional call site logging (file and line number of log call) Supports JSON, LTSV, and colorized console output formats. Pattern is to create a unique logger for each go package, then selectively turn on debug logging forīuilt on top of zap, which is super fast. Levels can be configured for each named logger. Or infos, trace should just be debug, and a log package shouldn't be responsible for panics or exits. Debug: Slow, verbose logging, not appropriate for long-term production useįlume is a little opinionated about having only a few logs levels. Info: High priority, low volume messages. Error: Something that would be reported up to an error reporting service ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |