Documentation ¶
Overview ¶
Package log provides a number of logging utility functions for encoding and decoding log messages between a stash server and a plugin instance.
Log messages sent from a plugin instance are transmitted via stderr and are encoded with a prefix consisting of special character SOH, then the log level (one of t, d, i, w, e, or p - corresponding to trace, debug, info, warning, error and progress levels respectively), then special character STX.
The Trace, Debug, Info, Warning, and Error methods, and their equivalent formatted methods are intended for use by plugin instances to transmit log messages. The Progress method is also intended for sending progress data.
Conversely, LevelFromName and DetectLogLevel are intended for use by the stash server.
Index ¶
- Variables
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Progress(progress float64)
- func Trace(args ...interface{})
- func Tracef(format string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Level
Constants ¶
This section is empty.
Variables ¶
var ( TraceLevel = Level{ Name: "trace", // contains filtered or unexported fields } DebugLevel = Level{ Name: "debug", // contains filtered or unexported fields } InfoLevel = Level{ Name: "info", // contains filtered or unexported fields } WarningLevel = Level{ Name: "warning", // contains filtered or unexported fields } ErrorLevel = Level{ Name: "error", // contains filtered or unexported fields } ProgressLevel = Level{ // contains filtered or unexported fields } NoneLevel = Level{ Name: "none", } )
Valid Level values.
Functions ¶
func Debug ¶
func Debug(args ...interface{})
Debug outputs a debug logging message to os.Stderr. Message is encoded with a prefix that signifies to the server that it is a debug message.
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf is the equivalent of Printf outputting as a debug logging message.
func Error ¶
func Error(args ...interface{})
Error outputs an error logging message to os.Stderr. Message is encoded with a prefix that signifies to the server that it is an error message.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf is the equivalent of Printf outputting as an error logging message.
func Info ¶
func Info(args ...interface{})
Info outputs an info logging message to os.Stderr. Message is encoded with a prefix that signifies to the server that it is an info message.
func Infof ¶
func Infof(format string, args ...interface{})
Infof is the equivalent of Printf outputting as an info logging message.
func Progress ¶
func Progress(progress float64)
Progress logs the current progress value. The progress value should be between 0 and 1.0 inclusively, with 1 representing that the task is complete. Values outside of this range will be clamp to be within it.
func Trace ¶
func Trace(args ...interface{})
Trace outputs a trace logging message to os.Stderr. Message is encoded with a prefix that signifies to the server that it is a trace message.
func Tracef ¶
func Tracef(format string, args ...interface{})
Tracef is the equivalent of Printf outputting as a trace logging message.
Types ¶
type Level ¶
type Level struct { Name string // contains filtered or unexported fields }
Level represents a logging level for plugin outputs.
func DetectLogLevel ¶
DetectLogLevel returns the Level and the logging string for a provided line of plugin output. It parses the string for logging control characters and determines the log level, if present. If not present, the plugin output is returned unchanged with a nil Level.
func LevelFromName ¶
LevelFromName returns the Level that matches the provided name or nil if the name does not match a valid value.