package
0.0.2410
Repository: https://github.com/veraison/services.git
Documentation: pkg.go.dev

# README

Configuration

  • level (optional): specify the minimum enabled logging level. Supported values (from lowest to highest) are: debug, info, warn, error. Defaults to info.
  • format (optional): specify the format of the log records (e.g. which entries appear in it). Currently supported formats:
    production: default zap production config.
    development: default zap development config.
    bare: a relatively bare format, featuring only log level (colored), logger name, and its message, suffixed with any fields.
  • development (optional): set to true to put the logger into development mode. This changes the behavior of DPanic and takes stacktraces more liberally.
  • disable-stacktrace (optional): set to true to completely disable automatic stacktrace capturing.
  • sampling (optional): set the sampling policy. There are two possible sub-settings: initial and thereafter, each is an integer value. initial specifies how many messages, of a given level, will be logged as-is every second. After than, only every thereafter'th message will be logged within that seconds. e.g.
      sampling:
        initial: 10
        thereafer: 5
    
    means, for very level (debug, info, etc) log the first 10 messages that occur in 1 second. If more messages occur within the second, log every 5th message after the first 10.
  • encoding (optional): specifies logger encoding. Supported values: console, json.
  • output-paths (optional): a list of URLs or file paths to write logging output to. By default, output is written to stdout (which may also be specified as a "path" along other locations). In case the same configuration is used by multiple services, you can insert "{{ .service }}" somewhere in paths (part from stdout/stderr) to have different services log into different files.
  • err-output-paths (optional): a list of URLs or file paths to write internal logger errors to (note: not the error-level logging output). Defaults to stderr. In case the same configuration is used by multiple services, you can insert "{{ .service }}" somewhere in paths (part from stdout/stderr) to have different services log into different files.
  • initial-fields (optional): a map of key-value fields to add to log records (in addition to those added by specific logging sites).

# Functions

An encoder for zap log levels that colorizes them based on their value.
Debug uses fmt.Sprint to construct and log a message.
Debugf uses fmt.Sprintf to log a templated message.
Debugln uses fmt.Sprintln to construct and log a message.
Debugw logs a message with some additional context.
DPanic uses fmt.Sprint to construct and log a message.
DPanicf uses fmt.Sprintf to log a templated message.
DPanicln uses fmt.Sprintln to construct and log a message.
DPanicw logs a message with some additional context.
Error uses fmt.Sprint to construct and log a message.
Errorf uses fmt.Sprintf to log a templated message.
Errorln uses fmt.Sprintln to construct and log a message.
Errorw logs a message with some additional context.
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
Fatalln uses fmt.Sprintln to construct and log a message, then calls os.Exit.
Fatalw logs a message with some additional context, then calls os.Exit.
GetLevel returns the current global logging level.
Info uses fmt.Sprint to construct and log a message.
Infof uses fmt.Sprintf to log a templated message.
Infoln uses fmt.Sprintln to construct and log a message.
Infow logs a message with some additional context.
Init initializes services global logging.
InitGinWriter sets up gin DefaultWriter to use Veraison logging.
LogProblem logs a problems.StatusProblem reported by the api.
Create a new logger (derived from the global root) with the specified name.
NamedWriter creates an io.Writer that utilizes a zap logger with the specified name at the specifed level.
No description provided by the author
NewInternalLogger returns a new logger that logs all Info level messages at Debug level.
No description provided by the author
Panic uses fmt.Sprint to construct and log a message, then panics.
Panicf uses fmt.Sprintf to log a templated message, then panics.
Panicln uses fmt.Sprintln to construct and log a message, then panics.
Panicw logs a message with some additional context, then panics.
SetLevel sets the global logging level.
Sync loggers' io sinks.
VerboseViper enables verbose output level for Viper loggers.
Warn uses fmt.Sprint to construct and log a message.
Warnf uses fmt.Sprintf to log a templated message.
Warnln uses fmt.Sprintln to construct and log a message.
Warnw logs a message with some additional context.
WriterFromZap returns an io.Writer utilzing the provided zap logger at the specified level.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Config is, essentially, and adapter for zap.Config that defines mapstructure tags for zap.Config fields, and provides any additional Veraison-specific validation.
GinColorWriter wraps zapio.Writer to provide warning and error highlighting inside gin traces.
HCLogger is a wrapper around zap logger used by Veraison that implements go-hclog.Logger interface expected by go-plugin plugins.