log

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: AGPL-3.0 Imports: 2 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{
		&logger.TraceLevel,
	}
	DebugLevel = Level{
		&logger.DebugLevel,
	}
	InfoLevel = Level{
		&logger.InfoLevel,
	}
	WarningLevel = Level{
		&logger.WarningLevel,
	}
	ErrorLevel = Level{
		&logger.ErrorLevel,
	}
	ProgressLevel = Level{
		&logger.ProgressLevel,
	}
	NoneLevel = Level{
		&logger.NoneLevel,
	}
)

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 {
	*logger.PluginLogLevel
}

Level represents a logging level for plugin outputs.

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