ng

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 30 Imported by: 39

Documentation

Overview

//http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#8-colors

//Global Format
	\u001b[+COLOR+m		Non BRIGHT
	\u001b[+COLOR+;1m	BRIGHT

// FORMATTING
	\u001b[1m		BOLD
	\u001b[4m		Underline
	\u001b[7m		Reversed

// Formats Foreground
	8 bit		\u001b[30m
	16 bit		\u001b[30;1m
	256 bit 	\u001b[38;5;${ID}m

//Colors
	CLR_BLK       = "\x1b[30m"   // black
	CLR_BLKBRIGHT = "\x1b[30;1m" // black bright
	CLR_RED       = "\x1b[31m"   // red
	CLR_REDBRT    = "\x1b[31;1m" // red
	CLR_GRN       = "\x1b[32m"   // green
	CLR_YLLW      = "\x1b[33m"   // yellow
	CLR_BLU       = "\x1b[34;1m" // blue
	CLR_MAG       = "\x1b[35;1m" // magenta
	CLR_CYAN      = "\x1b[36;1m" // cyan
	CLR_WHT   = "\x1b[37;1m" // white

CLR_RESET = "\x1b[0m" // reset to default

//ASCII 256
	CLR_DEFAULT = "\x1b[38;5;10m"
	CLR_ERR     = "\x1b[38;5;196m" //red
	CLR_WARN    = "\x1b[38;5;11m"  //yellow
	CLR_INFO    = "\x1b[38;5;174m" // light red/brown

//Formats Background Color
bright versions of the background colors do not change the background,
	but rather make the foreground text brighter
8 bit 	\u001b[40m
16 bit 	\u001b[40;1m
256 bit	\u001b[48;5;
CLRBG_BLK        = "\x1b[40m"
CLRBG_BLKBRIGHTb = "\x1b[40;1m"

Index

Constants

View Source
const (
	ParamMsg   = "msg"
	ParamLevel = "level"
	ParamTime  = "time"
)

Default key names for the default fields

View Source
const (
	XMLParamMsg   = "msg"
	XMLParamLevel = "level"
	XMLParamTime  = "time"
)

Default key names for the default fields

View Source
const DefaultTimestampFormat = "2006-01-02T15:04:05.00000Z07:00"

Variables

View Source
var (
	// if NOT a terminal then turn off COLOR
	DumbTerm    = os.Getenv("TERM") == "dumb"
	Term        = isatty.IsTerminal(os.Stdout.Fd())
	CygwinTerm  = isatty.IsCygwinTerminal(os.Stdout.Fd())
	NotTerminal = os.Getenv("TERM") == "dumb" ||
		(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
)
View Source
var (
	DBGL3   = enum.DBGL3
	DBGL2   = enum.DBGL2
	DEBUG   = enum.DEBUG
	FATAL   = enum.FATAL
	FATALNE = enum.FATALNOEXIT
	ERROR   = enum.ERROR
	WARN    = enum.WARN
	INFO    = enum.INFO
	NONE    = enum.NONE
)

Functions

func Black

func Black(format string, a ...interface{}) string

func Blue

func Blue(format string, a ...interface{}) string

func Bool2Str

func Bool2Str(val bool) string

func BrightBlack added in v0.0.14

func BrightBlack(format string, a ...interface{}) string

func ColorBrightFmt

func ColorBrightFmt(color ColorAttr) string

func ColorFmt

func ColorFmt(color ColorAttr) string

func Cyan

func Cyan(format string, a ...interface{}) string

func Debug

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

func DebugL2 added in v0.0.14

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

func DebugL3ln added in v0.0.14

func DebugL3ln(args ...interface{})

func DebugX2

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

func DebugX2ln

func DebugX2ln(args ...interface{})

func Debugln

func Debugln(args ...interface{})

func DisableColor added in v0.0.22

func DisableColor()

func DisableTextQuoting added in v0.0.19

func DisableTextQuoting()

func DisableTimestamp

func DisableTimestamp()

func EnableColor added in v0.0.22

func EnableColor()

func EnableTextQuoting added in v0.0.19

func EnableTextQuoting()

func EnableTimestamp

func EnableTimestamp()

func Error

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

func Errorln

func Errorln(args ...interface{})

func Exit

func Exit(code int)

func Flags

func Flags() int

func Green

func Green(format string, a ...interface{}) string

func Info

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

func Infoln

func Infoln(args ...interface{})

func IsDebug

func IsDebug() bool

func IsDebugL3 added in v0.0.14

func IsDebugL3() bool

func IsDebugX2

func IsDebugX2() bool

func IsError

func IsError() bool

func IsFatal

func IsFatal() bool

func IsFatalNE added in v0.0.14

func IsFatalNE() bool

func IsInfo

func IsInfo() bool

func IsNone

func IsNone() bool

func IsWarn

func IsWarn() bool

func Level

func Level() enum.LogLevel

func Logf

func Logf(lvl enum.LogLevel, format string, args ...interface{})

func Logln

func Logln(lvl enum.LogLevel, args ...interface{})

func Magenta

func Magenta(format string, a ...interface{}) string

func Modify

func Modify(opts ...LogOption)

func Print

func Print(args ...interface{})

func PrintGoSyntaxOfValue added in v0.0.15

func PrintGoSyntaxOfValue(arg interface{})

func PrintStructWithFieldNames added in v0.0.15

func PrintStructWithFieldNames(arg interface{})

func PrintStructWithFieldNamesIndent added in v0.0.16

func PrintStructWithFieldNamesIndent(arg interface{}, indent bool)

func PrintTypeOfValue added in v0.0.15

func PrintTypeOfValue(arg interface{})

func Printf

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

func Println

func Println(args ...interface{})

func Red

func Red(format string, a ...interface{}) string

func SetFlags

func SetFlags(flg enum.Flags)

func SetFormatter

func SetFormatter(formatter Layout)

func SetLevel

func SetLevel(level enum.LogLevel)

func ShowAppenders added in v0.0.13

func ShowAppenders() []string

func ShowConfig

func ShowConfig()

func White

func White(format string, a ...interface{}) string

func Yellow

func Yellow(format string, a ...interface{}) string

Types

type Appender

type Appender interface {
	Name() string
	//package or name to find in message, in Java this was a package
	Applicable(filter string) bool
	Process(msg []byte)
	DisableColor() bool
}

Appender

type Auth added in v0.0.5

type Auth struct {
	Username []byte
	Password []byte
}

type ByNumericalFilename added in v0.0.12

type ByNumericalFilename []os.FileInfo

func (ByNumericalFilename) Len added in v0.0.12

func (nf ByNumericalFilename) Len() int

func (ByNumericalFilename) Less added in v0.0.12

func (nf ByNumericalFilename) Less(i, j int) bool

func (ByNumericalFilename) Swap added in v0.0.12

func (nf ByNumericalFilename) Swap(i, j int)

type ByNumericalFilenameRev added in v0.0.12

type ByNumericalFilenameRev []os.FileInfo

func (ByNumericalFilenameRev) Len added in v0.0.12

func (nf ByNumericalFilenameRev) Len() int

func (ByNumericalFilenameRev) Less added in v0.0.12

func (nf ByNumericalFilenameRev) Less(i, j int) bool

func (ByNumericalFilenameRev) Swap added in v0.0.12

func (nf ByNumericalFilenameRev) Swap(i, j int)

type Client added in v0.0.5

type Client struct {
	DialTimeout           time.Duration
	DialKeepAliveTimeout  time.Duration
	MaxIdleConnections    int
	IdleConnTimeout       time.Duration
	TlsHandshakeTimeout   time.Duration
	ResponseHeaderTimeout time.Duration
	//ExpectContinueTimeout    time.Duration	// will disable HTTP2 if used
	HttpClientRequestTimeout time.Duration
	// contains filtered or unexported fields
}

func (*Client) Fetch added in v0.0.5

func (c *Client) Fetch(method, url string, auth *Auth, header map[string]string, body io.Reader) (*http.Response, error)

type Clr

type Clr struct {
	// contains filtered or unexported fields
}

func CachedColor

func CachedColor(p ColorAttr) *Clr

func New

func New(value ...ColorAttr) *Clr

func (*Clr) Add

func (c *Clr) Add(value ...ColorAttr) *Clr

func (*Clr) DisableColor

func (c *Clr) DisableColor()

func (*Clr) Print

func (c *Clr) Print(format string) string

func (*Clr) Printf

func (c *Clr) Printf(format string, a ...interface{}) string

func (*Clr) Set

func (c *Clr) Set() string

type ColorAttr

type ColorAttr int
const (
	Reset ColorAttr = iota
	BOLD
	FAINT // does nothing
	ITALIC
	UNDERLINE
	BlinkSlow  // does nothing
	BlinkRapid // does nothing
	Reversed
	NonDisplayed
)

Base Color Attributes

const (
	FgBlack ColorAttr = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite

	CLRRESET              = "\u001b[0m" // reset to default
	ClearTerminalSequence = "\033[2J"
)

FG Text Colors

const (
	HiBlack ColorAttr = iota + 90
	HiRed
	HiGreen
	HiYellow
	HiBlue
	HiMagenta
	HiCyan
	HiWhite
)

FG Hi-Intensity Text

const (
	BgBlack ColorAttr = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)

BG text colors

const (
	BgHiBlack ColorAttr = iota + 100
	BgHiRed
	BgHiGreen
	BgHiYellow
	BgHiBlue
	BgHiMagenta
	BgHiCyan
	BgHiWhite
)

Background Hi-Intensity text colors

func (ColorAttr) String

func (l ColorAttr) String() string

func (ColorAttr) Types

func (l ColorAttr) Types() map[int]string

Types pulls full list as []string

func (ColorAttr) Val

func (l ColorAttr) Val() int

func (ColorAttr) ValAsString

func (l ColorAttr) ValAsString() string

type Column

type Column struct {
	// contains filtered or unexported fields
}

type ConsoleAppender

type ConsoleAppender struct {
	*OutAppender
}

******************* CONSOLE APPENDER ********************

func NewConsoleAppender

func NewConsoleAppender(filter string) *ConsoleAppender

func (*ConsoleAppender) Applicable

func (c *ConsoleAppender) Applicable(filter string) bool

func (*ConsoleAppender) DisableColor

func (c *ConsoleAppender) DisableColor() bool

func (*ConsoleAppender) Name

func (c *ConsoleAppender) Name() string

func (*ConsoleAppender) Process

func (c *ConsoleAppender) Process(msg []byte)

type CronTriggerPolicy

type CronTriggerPolicy struct {
	// contains filtered or unexported fields
}

tests using cron

func NewCronTriggerPolicy

func NewCronTriggerPolicy(schedule string) *CronTriggerPolicy

func (*CronTriggerPolicy) Rotate

func (s *CronTriggerPolicy) Rotate(fileName string, strategy Strategy) (bool, error)

type FailoverAppender

type FailoverAppender struct {
	RetryIntervalSeconds int // default 60 sec
	// contains filtered or unexported fields
}

******************* FAIL OVER APPENDER ********************

func NewFailoverAppender

func NewFailoverAppender(primary Appender, failovers []Appender) *FailoverAppender

func (*FailoverAppender) Applicable

func (f *FailoverAppender) Applicable(msg string) bool

func (*FailoverAppender) DisableColor

func (f *FailoverAppender) DisableColor() bool

func (*FailoverAppender) Name

func (f *FailoverAppender) Name() string

func (*FailoverAppender) Process

func (f *FailoverAppender) Process(msg []byte)

type Fields

type Fields map[string]interface{}

Fields type, used to pass to `WithFields`.

func (Fields) MarshalXML added in v0.0.9

func (m Fields) MarshalXML(e *xml.Encoder, start xml.StartElement) error

StringMap marshals into XML.

type FileAppender

type FileAppender struct {
	*OutAppender

	FilePerm os.FileMode //default 0777
	UserID   int
	GroupID  int
	// contains filtered or unexported fields
}

func NewFileAppender

func NewFileAppender(filter, fileName, name string, bufferSize int) (*FileAppender, error)

func (*FileAppender) Applicable

func (f *FileAppender) Applicable(msg string) bool

func (*FileAppender) DisableColor

func (f *FileAppender) DisableColor() bool

func (*FileAppender) Name

func (f *FileAppender) Name() string

func (*FileAppender) Process

func (f *FileAppender) Process(msg []byte)

type FileStrategy added in v0.0.14

type FileStrategy struct {
	// contains filtered or unexported fields
}

func DefaultFileStrategy added in v0.0.14

func DefaultFileStrategy() *FileStrategy

func NewDefaultFileStrategy added in v0.0.14

func NewDefaultFileStrategy(maxKeep, compressionLevel int) *FileStrategy

func (*FileStrategy) CompressionLevel added in v0.0.14

func (s *FileStrategy) CompressionLevel() int

func (*FileStrategy) Max added in v0.0.14

func (s *FileStrategy) Max() int

type HTTPAppender added in v0.0.5

type HTTPAppender struct {
	*OutAppender
	// contains filtered or unexported fields
}

func NewHTTPAppender added in v0.0.5

func NewHTTPAppender(filter, url, username, password string) (*HTTPAppender, error)

func (*HTTPAppender) Applicable added in v0.0.5

func (f *HTTPAppender) Applicable(msg string) bool

func (*HTTPAppender) DisableColor added in v0.0.5

func (f *HTTPAppender) DisableColor() bool

func (*HTTPAppender) Name added in v0.0.5

func (f *HTTPAppender) Name() string

func (*HTTPAppender) Process added in v0.0.5

func (f *HTTPAppender) Process(msg []byte)

type JSONLayout

type JSONLayout struct {
	// TimestampFormat sets the format used for marshaling timestamps.
	TimestampFormat string

	// DisableTimestamp allows disabling automatic timestamps in output
	DisableTimestamp bool
	DisableQuoting   bool
	ParamMap         ParamMap
}

func (*JSONLayout) Colors

func (f *JSONLayout) Colors(enable bool)

func (*JSONLayout) Description

func (f *JSONLayout) Description() string

func (*JSONLayout) DisableTextQuoting added in v0.0.19

func (f *JSONLayout) DisableTextQuoting()

func (*JSONLayout) DisableTimeStamp

func (f *JSONLayout) DisableTimeStamp()

func (*JSONLayout) EnableTextQuoting added in v0.0.19

func (f *JSONLayout) EnableTextQuoting()

func (*JSONLayout) EnableTimeStamp

func (f *JSONLayout) EnableTimeStamp()

func (*JSONLayout) Format

func (f *JSONLayout) Format(entry *LogMsg, disableColor bool) ([]byte, error)

type Layout

type Layout interface {
	Format(*LogMsg, bool) ([]byte, error)
	Description() string
	Colors(bool)
	DisableTimeStamp()
	EnableTimeStamp()
	DisableTextQuoting()
	EnableTextQuoting()
}

type LogMsg

type LogMsg struct {
	Logger *StdLogger
	//None, Fatal, Error, Warn, Info, Debug
	Level enum.LogLevel
	//Message passed into logger
	Message string
	//PlainMessage no colors no returns at end of line, etc..
	PlainMessage string
	//Fields passed to template i.e. for JSON output
	Fields []Fields
	// Time entry was created
	Time time.Time
	// When formatter is called in entry.log(), an Buffer may be set to entry
	Buffer *bytes.Buffer
	// contains filtered or unexported fields
}

Create a pool for reuse in order to speed up process of logging

func NewEntry

func NewEntry(logger *StdLogger) *LogMsg

func WithFields

func WithFields(fields []Fields) *LogMsg

WithFields creates an entry from the standard logger and adds multiple fields to it. This is simply a helper for `WithField`, invoking it once for each field.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

func (*LogMsg) Error

func (entry *LogMsg) Error(args ...interface{})

func (*LogMsg) Fatal

func (entry *LogMsg) Fatal(args ...interface{})

func (*LogMsg) Info

func (entry *LogMsg) Info(args ...interface{})

func (*LogMsg) LogEnt

func (entry *LogMsg) LogEnt(level enum.LogLevel, format, caller string, rtn bool, args ...interface{})

func (*LogMsg) LogEntWithPlainText added in v0.0.19

func (entry *LogMsg) LogEntWithPlainText(level enum.LogLevel, format, caller string, plaintext *string, rtn bool, args ...interface{})

func (*LogMsg) WithFields

func (entry *LogMsg) WithFields(fields []Fields) *LogMsg

Add a map of fields to the Entry.

type LogOption

type LogOption func(h *StdLogger)

func Appenders

func Appenders(a ...Appender) LogOption

func CallDepth

func CallDepth(i int) LogOption

func ColorsOff added in v0.0.20

func ColorsOff() LogOption

func ColorsOn

func ColorsOn() LogOption

func DebugColor

func DebugColor(clr ColorAttr) LogOption

func DebugLvl2Color added in v0.0.14

func DebugLvl2Color(clr ColorAttr) LogOption

func DebugLvl3Color added in v0.0.14

func DebugLvl3Color(clr ColorAttr) LogOption

func ErrColor

func ErrColor(clr ColorAttr) LogOption

func Formatter added in v0.0.14

func Formatter(f Layout) LogOption

func HiColorsOn

func HiColorsOn() LogOption

func InfoColor

func InfoColor(clr ColorAttr) LogOption

func LogLevel

func LogLevel(l enum.LogLevel) LogOption

Logger returns a MDHashOption that sets the logger for the hash.

func LogOut

func LogOut(i io.Writer) LogOption

func SetFlgs

func SetFlgs(i enum.Flags) LogOption

func WarnColor

func WarnColor(clr ColorAttr) LogOption

type MailAppender added in v0.0.4

type MailAppender struct {
	*OutAppender
	// contains filtered or unexported fields
}

func NewMailAppender added in v0.0.4

func NewMailAppender(filter, smtpServer, smtpUsername, smtpPass, smtpFrom, smtpTo, smtpSubject string, smtpPort int) (*MailAppender, error)

func (*MailAppender) Applicable added in v0.0.4

func (f *MailAppender) Applicable(msg string) bool

func (*MailAppender) DisableColor added in v0.0.4

func (f *MailAppender) DisableColor() bool

func (*MailAppender) Name added in v0.0.4

func (f *MailAppender) Name() string

func (*MailAppender) Process added in v0.0.4

func (f *MailAppender) Process(msg []byte)

type OutAppender

type OutAppender struct {
	Out io.Writer
	// contains filtered or unexported fields
}

type ParamMap

type ParamMap map[key]string

FieldMap allows customization of the key names for default fields.

func (ParamMap) Find

func (f ParamMap) Find(key key) string

type PrinterTable

type PrinterTable struct {
	Table
	// contains filtered or unexported fields
}

func NewTable

func NewTable(header []string, rows [][]string, opts ...TableOption) (*PrinterTable, error)

func (*PrinterTable) AdjustData

func (t *PrinterTable) AdjustData()

func (*PrinterTable) Print

func (t *PrinterTable) Print()

Loop over each column and find largest width to make that column for all in it

func (*PrinterTable) Sizes

func (t *PrinterTable) Sizes()

type ResyncOnce

type ResyncOnce struct {
	// contains filtered or unexported fields
}

func (*ResyncOnce) Do

func (o *ResyncOnce) Do(f func())

func (*ResyncOnce) Reset

func (o *ResyncOnce) Reset()

type RollingFileAppender

type RollingFileAppender struct {
	*FileAppender
	// contains filtered or unexported fields
}

func NewRollingFileAppender

func NewRollingFileAppender(filter, fileName, name string, bufferSize int) (*RollingFileAppender, error)
 NewRollingFileAppender
	filter		source code path to apply to this appender i.e. github.com/colt3k/nglog/
	fileName	path and name of log file
	name		name of this appender
	bufferSize	0 (use default: 8192)

func NewRollingFileAppenderWithTrigger added in v0.0.14

func NewRollingFileAppenderWithTrigger(filter, fileName, name string, bufferSize int, trigger TriggerPolicy) (*RollingFileAppender, error)
NewRollingFileAppenderWithTrigger

filter source code path to apply to this appender i.e. github.com/colt3k/nglog/ fileName path and name of log file name name of this appender bufferSize 0 (use default: 8192) trigger *TriggerPolicy that fires off a rotation strategy *Strategy to apply to rotated file

func NewRollingFileAppenderWithTriggerAndStrategy added in v0.0.14

func NewRollingFileAppenderWithTriggerAndStrategy(filter, fileName, name string, bufferSize int, trigger TriggerPolicy, strategy Strategy) (*RollingFileAppender, error)
 NewRollingFileAppenderWithTriggerAndStrategy
	filter		source code path to apply to this appender i.e. github.com/colt3k/nglog/
	fileName	path and name of log file
	name		name of this appender
	bufferSize	0 (use default: 8192)
	trigger		*TriggerPolicy that fires off a rotation
	strategy	*Strategy to apply to rotated file

func (*RollingFileAppender) Applicable

func (r *RollingFileAppender) Applicable(filter string) bool

func (*RollingFileAppender) DisableColor

func (r *RollingFileAppender) DisableColor() bool

func (*RollingFileAppender) Name

func (r *RollingFileAppender) Name() string

func (*RollingFileAppender) Process

func (r *RollingFileAppender) Process(msg []byte)

TODO add logging for rolling

type Row

type Row struct {
	// contains filtered or unexported fields
}

func BuildRow

func BuildRow(row []string) *Row

func BuildTableBody

func BuildTableBody(rowsData [][]string) []*Row

type SizeTriggerPolicy

type SizeTriggerPolicy struct {
	// contains filtered or unexported fields
}

checks while running or on start

func DefaultSizeTriggerPolicy added in v0.0.14

func DefaultSizeTriggerPolicy() *SizeTriggerPolicy

DefaultSizeTriggerPolicy sets maxSizeMB to default of 4

func NewSizeTriggerPolicy

func NewSizeTriggerPolicy(maxSizeMB float64) *SizeTriggerPolicy

func (*SizeTriggerPolicy) Rotate

func (s *SizeTriggerPolicy) Rotate(fileName string, strategy Strategy) (bool, error)

type SocketAppender added in v0.0.6

type SocketAppender struct {
	*OutAppender
	// contains filtered or unexported fields
}

func NewSocketAppender added in v0.0.6

func NewSocketAppender(filter, server, port string) (*SocketAppender, error)

func (*SocketAppender) Applicable added in v0.0.6

func (f *SocketAppender) Applicable(msg string) bool

func (*SocketAppender) DisableColor added in v0.0.6

func (f *SocketAppender) DisableColor() bool

func (*SocketAppender) Name added in v0.0.6

func (f *SocketAppender) Name() string

func (*SocketAppender) Process added in v0.0.6

func (f *SocketAppender) Process(msg []byte)

type StdLogger

type StdLogger struct {
	Formatter Layout

	Out io.Writer

	ColorDEFAULT string
	ColorERR     string
	ColorWARN    string
	ColorINFO    string
	ColorDEBUG   string
	ColorDEBUGL2 string
	ColorDEBUGL3 string

	// Used to sync writing to the log. Locking is enabled by Default
	MU  util.MutexWrap
	Now time.Time
	// contains filtered or unexported fields
}

func Logger

func Logger() *StdLogger

func NewLogger

func NewLogger(opts ...LogOption) *StdLogger

NewLogger can be used instead of the default to change settings

func (*StdLogger) Caller

func (l *StdLogger) Caller() string

func (*StdLogger) Flags

func (l *StdLogger) Flags() int

func (*StdLogger) Level

func (l *StdLogger) Level() enum.LogLevel

func (*StdLogger) Logf

func (l *StdLogger) Logf(lvl enum.LogLevel, format string, args ...interface{})

func (*StdLogger) Logln

func (l *StdLogger) Logln(lvl enum.LogLevel, args ...interface{})

func (*StdLogger) Print

func (l *StdLogger) Print(args ...interface{})

func (*StdLogger) PrintGoSyntaxOfValue added in v0.0.15

func (l *StdLogger) PrintGoSyntaxOfValue(arg interface{})

func (*StdLogger) PrintStructWithFieldNames added in v0.0.15

func (l *StdLogger) PrintStructWithFieldNames(arg interface{})

func (*StdLogger) PrintStructWithFieldNamesIndent added in v0.0.16

func (l *StdLogger) PrintStructWithFieldNamesIndent(arg interface{}, indent bool)

func (*StdLogger) PrintTypeOfValue added in v0.0.15

func (l *StdLogger) PrintTypeOfValue(arg interface{})

func (*StdLogger) Printf

func (l *StdLogger) Printf(format string, args ...interface{})

func (*StdLogger) Println

func (l *StdLogger) Println(args ...interface{})

func (*StdLogger) SetFlags

func (l *StdLogger) SetFlags(flg enum.Flags)

* SetFlags Ldate = 1 << iota // the date in the local time zone: 2009/01/23 Ltime // the time in the local time zone: 01:23:23 Lmicroseconds // microsecond resolution: 01:23:23.123123. assumes Ltime. Llongfile // full file name and line number: /a/b/c/d.go:23 Lshortfile // final file name element and line number: d.go:23. overrides Llongfile LUTC // if Ldate or Ltime is set, use UTC rather than the local time zone LstdFlags = Ldate | Ltime // initial values for the standard logger

func (*StdLogger) SetFormatter

func (l *StdLogger) SetFormatter(formatter Layout)

func (*StdLogger) SetLevel

func (l *StdLogger) SetLevel(level enum.LogLevel)

func (*StdLogger) ShowOptions

func (l *StdLogger) ShowOptions()

func (*StdLogger) WithFields

func (l *StdLogger) WithFields(fields []Fields) *LogMsg

Adds a struct of fields to the log entry. All it does is call `WithField` for each `Field`.

type Strategy

type Strategy interface {
	Max() int
	CompressionLevel() int
}

Archive strategy

type SyslogAppender added in v0.0.7

type SyslogAppender struct {
	*OutAppender
}

******************* Syslog APPENDER ********************

func NewSyslogAppender added in v0.0.7

func NewSyslogAppender(filter, programName string) (*SyslogAppender, error)

func (*SyslogAppender) Applicable added in v0.0.7

func (c *SyslogAppender) Applicable(filter string) bool

func (*SyslogAppender) DisableColor added in v0.0.7

func (c *SyslogAppender) DisableColor() bool

func (*SyslogAppender) Name added in v0.0.7

func (c *SyslogAppender) Name() string

func (*SyslogAppender) Process added in v0.0.7

func (c *SyslogAppender) Process(msg []byte)

type Table

type Table struct {
	// contains filtered or unexported fields
}

type TableOption

type TableOption func(h *PrinterTable)

func TableBorder

func TableBorder(border bool) TableOption

func TableHorizontal

func TableHorizontal(horizontal bool) TableOption

func TableName

func TableName(tblName string) TableOption

type TextLayout

type TextLayout struct {
	//Force Color
	ForceColor bool
	// Force disabling colors.
	DisableColors bool

	// TimestampFormat to use for display when a full timestamp is printed
	TimestampFormat string // The fields are sorted by default for a consistent output. For applications
	// that log extremely frequently and don't use the JSON formatter this may not
	// be desired.
	DisableSorting   bool
	QuoteEmptyVal    bool
	DisableTimestamp bool
	DisableQuoting   bool
	sync.Once
	// contains filtered or unexported fields
}

func (*TextLayout) Colors

func (f *TextLayout) Colors(enable bool)

func (*TextLayout) Description

func (f *TextLayout) Description() string

func (*TextLayout) DisableTextQuoting added in v0.0.19

func (f *TextLayout) DisableTextQuoting()

func (*TextLayout) DisableTimeStamp

func (f *TextLayout) DisableTimeStamp()

func (*TextLayout) EnableTextQuoting added in v0.0.19

func (f *TextLayout) EnableTextQuoting()

func (*TextLayout) EnableTimeStamp

func (f *TextLayout) EnableTimeStamp()

func (*TextLayout) Format

func (f *TextLayout) Format(entry *LogMsg, disableColor bool) ([]byte, error)

type TimeTriggerPolicy

type TimeTriggerPolicy struct {
	// contains filtered or unexported fields
}

tests on interval of hours with a possible max random delay of X

func NewTimeTriggerPolicy

func NewTimeTriggerPolicy(interval, maxRandomDelay int) *TimeTriggerPolicy

func (*TimeTriggerPolicy) Rotate

func (s *TimeTriggerPolicy) Rotate(fileName string, strategy Strategy) (bool, error)

type TriggerPolicy

type TriggerPolicy interface {
	Rotate(string, Strategy) (bool, error)
}

type XMLLayout added in v0.0.9

type XMLLayout struct {
	// TimestampFormat sets the format used for marshaling timestamps.
	TimestampFormat string

	// DisableTimestamp allows disabling automatic timestamps in output
	DisableTimestamp bool
	DisableQuoting   bool

	ParamMap XMLParamMap
}

func (*XMLLayout) Colors added in v0.0.9

func (f *XMLLayout) Colors(enable bool)

func (*XMLLayout) Description added in v0.0.9

func (f *XMLLayout) Description() string

func (*XMLLayout) DisableTextQuoting added in v0.0.19

func (f *XMLLayout) DisableTextQuoting()

func (*XMLLayout) DisableTimeStamp added in v0.0.9

func (f *XMLLayout) DisableTimeStamp()

func (*XMLLayout) EnableTextQuoting added in v0.0.19

func (f *XMLLayout) EnableTextQuoting()

func (*XMLLayout) EnableTimeStamp added in v0.0.9

func (f *XMLLayout) EnableTimeStamp()

func (*XMLLayout) Format added in v0.0.9

func (f *XMLLayout) Format(entry *LogMsg, disableColor bool) ([]byte, error)

type XMLParamMap added in v0.0.9

type XMLParamMap map[keyXML]string

FieldMap allows customization of the key names for default fields.

func (XMLParamMap) Find added in v0.0.9

func (f XMLParamMap) Find(key keyXML) string

Jump to

Keyboard shortcuts

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