log

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2020 License: AGPL-3.0 Imports: 4 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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.

func Warn

func Warn(args ...interface{})

Warn outputs a warning logging message to os.Stderr. Message is encoded with a prefix that signifies to the server that it is a warning message.

func Warnf

func Warnf(format string, args ...interface{})

Warnf is the equivalent of Printf outputting as a warning 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

func DetectLogLevel(line string) (*Level, string)

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

func LevelFromName(name string) *Level

LevelFromName returns the Level that matches the provided name or nil if the name does not match a valid value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL