log

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LoggerKey the key used to when logging the command
	// if the default logger is used and Silent is not specified
	// represents the action of the command
	LoggerKey = LoggerRunKey

	// LoggerCols specifies the right justified columns the LoggerKey will be padded
	LoggerCols = "5"

	// LoggerColor the default color used to print the LoggerKey
	// if the default logger is used and Silent is not specified
	LoggerColor = LoggerTeal

	// LoggerDryRunColor the color used to print the LoggerDryRunKey when DryRun
	// is invoked if the default logger is used and Silent is not specified
	LoggerDryRunColor = LoggerYellow

	// LoggerDryRunCols specifies the right justified columns the LoggerKey will be padded when
	// DryRun is invoked
	LoggerDryRunCols = "10"

	// LoggerDryRunKey the key used to represent the action of the command when DryRun is invoked
	LoggerDryRunKey = "dry"

	// LoggerKillKey the key used to represent the action of the command when Kill is invoked
	LoggerKillKey = "kill"

	// LoggerOutputKey the key used to represent the action of the command when Output is invoked
	LoggerOutputKey = "output"

	// LoggerRunKey the key used to represent the action of the command when Run is invoked
	LoggerRunKey = "run"

	// LoggerStartKey the key used to represent the action of the command when Start is invoked
	LoggerStartKey = "start"

	// LoggerWaitKey the key used to represent the action of the command when Start is invoked
	LoggerWaitKey = "wait"

	// LoggerBlack the default color code representing the color Black in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerBlack Color = "\033[1;30m"

	// LoggerRed the default color code representing the color Red in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerRed Color = "\033[1;31m"

	// LoggerGreen the default color code representing the color Green in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerGreen Color = "\033[1;32m"

	// LoggerYellow the default color code representing the color Yellow in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerYellow Color = "\033[1;33m"

	// LoggerPurple the default color code representing the color Purple in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerPurple Color = "\033[1;34m"

	// LoggerMagenta the default color code representing the color Magenta in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerMagenta Color = "\033[1;35m"

	// LoggerTeal the default color code representing the color Teal in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerTeal Color = "\033[1;36m"

	// LoggerWhite the default color code representing the color White in human readable format
	// only used when set to either LoggerColor or LoggerDryRunColor
	LoggerWhite Color = "\033[1;37m"

	// LoggerDarkGrey the default color code representing the color DarkGrey in human readable
	// format only used when set to either LoggerColor or LoggerDryRunColor
	LoggerDarkGrey Color = "\033[90m"

	// LoggerClear the default color code used to clear colors or return the print statement to the default
	LoggerClear Color = "\033[0m"

	// LoggerTimeFormat format to use when logging the timestamp - when LoggerTimeStampEnabled
	LoggerTimeFormat = time.RFC3339

	// LoggerTimeStampEnabled if set to true logger will include a timestamp
	LoggerTimeStampEnabled = true
)

Functions

func New

func New() *logger

New returns a new logger instance which implements the Logger interface

Types

type Color

type Color string

Color a string alias for logging colors

type Logger

type Logger interface {
	// Log inserts a log entry.  Arguments may be handled in the manner
	// of fmt.Print, but the underlying logger may also decide to handle
	// them differently.
	Log(v ...interface{})

	// Logf inserts a log entry.  Arguments are handled in the manner of
	// fmt.Printf.
	Logf(format string, v ...interface{})
}

Logger is a generic logging interface see also: github.com/go-log/log

By default the built-in logger will be used. See Additional Logger* variables for configuration options.

Color is disabled by default, but can be enabled by setting either MAGEFILE_ENABLE_COLOR or CMDER_ENABLE_COLOR environment variables to true.

Jump to

Keyboard shortcuts

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