Documentation ¶
Index ¶
- Constants
- func DebugEnabled() bool
- func ErrorEnabled() bool
- func Fatal(str interface{}, v ...interface{})
- func InfoEnabled() bool
- func SetDebug(enabled bool)
- func SetDefaultOutput(o io.Writer)
- func SetError(enabled bool)
- func SetFieldRepresentation(representationType FieldRepresentationType)
- func SetInfo(enabled bool)
- func SetLogFormat(f Format)
- func SetScopeLength(length int)
- func SetShowLines(enabled bool)
- func SetTestMode()
- func SetWarning(enabled bool)
- func ShowLinesEnabled() bool
- func UnsetTestMode()
- func WarningEnabled() bool
- type FieldRepresentationType
- type Format
- type Instance
- func Debug(str interface{}, v ...interface{}) Instance
- func Error(str interface{}, v ...interface{}) Instance
- func Info(str interface{}, v ...interface{}) Instance
- func Log(str interface{}, v ...interface{}) Instance
- func LogNoFormat(str interface{}, v ...interface{}) Instance
- func Scope(scope string) Instance
- func Warn(str interface{}, v ...interface{}) Instance
- type LogLevel
- type LogOperation
- type StringCast
Constants ¶
const ( MSG LogOperation = "MSG" IO = "IO" AWAIT = "AWAIT" DONE = "DONE" NOTE = "NOTE" )
const ( // INFO represents a Information Log Level (or verbose) INFO LogLevel = "I" // WARN represents a Warning Log Level WARN = "W" // ERROR represents an error message ERROR = "E" // FATAL represents an fatal message FATAL = "F" // DEBUG represents an debug message DEBUG = "D" )
const LineBreak = "\n"
Variables ¶
This section is empty.
Functions ¶
func DebugEnabled ¶
func DebugEnabled() bool
DebugEnabled returns if the DEBUG level messages are currently enabled
func ErrorEnabled ¶
func ErrorEnabled() bool
ErrorEnabled returns if the ERROR level messages are currently enabled
func Fatal ¶
func Fatal(str interface{}, v ...interface{})
Fatal logs out a message in ERROR level and closes the program
func InfoEnabled ¶
func InfoEnabled() bool
InfoEnabled returns if the INFO level messages are currently enabled
func SetDebug ¶
func SetDebug(enabled bool)
SetDebug globally sets if the DEBUG level messages will be shown. Affects all instances
func SetDefaultOutput ¶
SetDefaultOutput sets the Global Default Output I/O and for every new instance created by Scope function
func SetError ¶
func SetError(enabled bool)
SetError globally sets if the ERROR level messages will be shown. Affects all instances
func SetFieldRepresentation ¶
func SetFieldRepresentation(representationType FieldRepresentationType)
SetFieldRepresentation globally sets if the representation of log fields. Affects all instances
func SetInfo ¶
func SetInfo(enabled bool)
SetInfo globally sets if the INFO level messages will be shown. Affects all instances
func SetLogFormat ¶
func SetLogFormat(f Format)
SetLogFormat globally sets the logging format. Affects all instances
func SetScopeLength ¶
func SetScopeLength(length int)
SetScopeLength sets the scope field length (adds left pad when nescessary) - Affects globally all SLog Instances
func SetShowLines ¶
func SetShowLines(enabled bool)
SetShowLines globally sets if the filename and line of the caller function will be shown. Affects all instances
func SetTestMode ¶
func SetTestMode()
SetTestMode sets the SLog Instances to test mode a.k.a. all logs disabled. Equivalent to set all levels visibility to false
func SetWarning ¶
func SetWarning(enabled bool)
SetWarning globally sets if the WARN level messages will be shown. Affects all instances
func ShowLinesEnabled ¶
func ShowLinesEnabled() bool
ShowLinesEnabled returns if the show filename and line from called function is currently enabled
func UnsetTestMode ¶
func UnsetTestMode()
UnsetTestMode sets the SLog Instances to default mode a.k.a. all logs enabled. Equivalent to set all levels visibility to true
func WarningEnabled ¶
func WarningEnabled() bool
WarningEnabled returns if the WARN level messages are currently enabled
Types ¶
type FieldRepresentationType ¶
type FieldRepresentationType int
FieldRepresentationType specifies which log instance fields formatting should be used
const ( // NoFields disables the representation of the log instance fields NoFields FieldRepresentationType = iota // JSONFields enables the representation of log instance fields and formats them as a json string JSONFields // KeyValueFields enables the representation of log instance fields and formats them as a comma separated key=value fields KeyValueFields )
type Format ¶
type Format string
Format specifies the logging format (could be pipe separated, JSON, ...)
type Instance ¶
type Instance interface { // Scope returns a new instance with the specified root scope (parent scope is discarded) Scope(string) Instance // SubScope returns a new instance with the specified scope appended to parent scope SubScope(string) Instance // WithCustomWriter returns a new instance with the specified custom output WithCustomWriter(io.Writer) Instance // WithFields returns a new instance with the parent fields plus the current fields. If key collision happens, the value specified in fields argument will be used. WithFields(map[string]interface{}) Instance // Tag returns a new instance with the specified tag. Tag(string) Instance // Operation returns a new instance with the specified operation. Operation(LogOperation) Instance // LogNoFormat prints a log string without any ANSI formatting LogNoFormat(interface{}, ...interface{}) Instance // Info logs out a message in INFO level Info(str interface{}, v ...interface{}) Instance // Debug logs out a message in DEBUG level Debug(str interface{}, v ...interface{}) Instance // Warn logs out a message in WARN level Warn(str interface{}, v ...interface{}) Instance // Error logs out a message in ERROR level Error(str interface{}, v ...interface{}) Instance // Fatal logs out a message in ERROR level and closes the program Fatal(str interface{}, v ...interface{}) // Note logs out a message in INFO level and with Operation NOTE. Returns an instance of operation NOTE Note(interface{}, ...interface{}) Instance // Await logs out a message in INFO level and with Operation AWAIT. Returns an instance of operation AWAIT Await(interface{}, ...interface{}) Instance // Done logs out a message in INFO level and with Operation DONE. Returns an instance of operation DONE Done(interface{}, ...interface{}) Instance // Success logs out a message in INFO level and with Operation DONE. Returns an instance of operation DONE Success(interface{}, ...interface{}) Instance // IO logs out a message in INFO level and with Operation IO. Returns an instance of operation IO IO(interface{}, ...interface{}) Instance // Log is equivalent of calling Info. It logs out a message in INFO level Log(interface{}, ...interface{}) Instance WarnDone(interface{}, ...interface{}) Instance WarnNote(interface{}, ...interface{}) Instance WarnAwait(interface{}, ...interface{}) Instance WarnSuccess(interface{}, ...interface{}) Instance WarnIO(interface{}, ...interface{}) Instance ErrorDone(interface{}, ...interface{}) Instance ErrorNote(interface{}, ...interface{}) Instance ErrorAwait(interface{}, ...interface{}) Instance ErrorSuccess(interface{}, ...interface{}) Instance ErrorIO(interface{}, ...interface{}) Instance DebugDone(interface{}, ...interface{}) Instance DebugNote(interface{}, ...interface{}) Instance DebugAwait(interface{}, ...interface{}) Instance DebugSuccess(interface{}, ...interface{}) Instance DebugIO(interface{}, ...interface{}) Instance }
Instance is a interface to a compatible SLog Logging Instance
func Debug ¶
func Debug(str interface{}, v ...interface{}) Instance
Debug logs out a message in DEBUG level
func Error ¶
func Error(str interface{}, v ...interface{}) Instance
Error logs out a message in ERROR level
func Info ¶
func Info(str interface{}, v ...interface{}) Instance
Info logs out a message in INFO level
func Log ¶
func Log(str interface{}, v ...interface{}) Instance
Log is equivalent of calling Info. It logs out a message in INFO level
func LogNoFormat ¶
func LogNoFormat(str interface{}, v ...interface{}) Instance
LogNoFormat prints a log string without any ANSI formatting
type LogOperation ¶
type LogOperation string
type StringCast ¶
type StringCast interface {
String() string
}