Documentation ¶
Index ¶
- Variables
- func AddEverythingFromPattern(pattern string)
- func AddNothingExceptFilter(pattern string)
- func AddPrivacyFilter(fn func(string) bool)
- func Color(colorString string) func(...interface{}) string
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func ExcludeFromPattern(pattern string)
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func Printf(level Level, format string, v ...interface{})
- func Println(level Level, v ...interface{})
- func SetLevel(level Level)
- func SetPrivacyFilterReplace(b bool)
- func SetStd(logger *Logger)
- func SetUseColor(useColor bool)
- func Warnf(format string, v ...interface{})
- func Warnln(v ...interface{})
- type Level
- type Logger
- func (l *Logger) AddEverythingFromPattern(pattern string)
- func (l *Logger) AddNothingExceptFilter(pattern string)
- func (l *Logger) AddPrivacyFilter(fn func(string) bool)
- func (l *Logger) ExcludeFromPattern(pattern string)
- func (l *Logger) Printf(level Level, format string, v ...interface{})
- func (l *Logger) Println(level Level, v ...interface{})
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetPrivacyFilterReplace(b bool)
- func (l *Logger) SetUseColor(useColor bool)
Constants ¶
This section is empty.
Variables ¶
var ( Debug = Teal Info = Green Warn = Yellow Error = Red )
*** Color code from https://gist.github.com/ik5/d8ecde700972d4378d87 ***
var ( Black = Color("\033[1;30m%s\033[0m") Red = Color("\033[1;31m%s\033[0m") Green = Color("\033[1;32m%s\033[0m") Yellow = Color("\033[1;33m%s\033[0m") Purple = Color("\033[1;34m%s\033[0m") Magenta = Color("\033[1;35m%s\033[0m") Teal = Color("\033[1;36m%s\033[0m") White = Color("\033[1;37m%s\033[0m") )
Functions ¶
func AddEverythingFromPattern ¶
func AddEverythingFromPattern(pattern string)
AddEverythingFromPattern adds a pattern to skip log level filtering, guaranteeing all logs matching the pattern are seen
func AddNothingExceptFilter ¶
func AddNothingExceptFilter(pattern string)
AddNothingExceptFilter enables strong filtering showing logs only for things on the approved list, adding this pattern to the list
func AddPrivacyFilter ¶ added in v1.0.2
AddPrivacyFilter adds a function applied to printf argument strings that can flag them as sensitive data
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf outputs the format and variables at the Debug level
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf outputs the format and variables at the Error level
func ExcludeFromPattern ¶
func ExcludeFromPattern(pattern string)
ExcludeFromPattern adds a pattern to exclude logs from
func Infof ¶
func Infof(format string, v ...interface{})
Infof outputs the format and variables at the Info level
func Println ¶
func Println(level Level, v ...interface{})
Println outputs the varibles assuming they pass the filter level
func SetLevel ¶
func SetLevel(level Level)
SetLevel changes the filtering level of the system logger
func SetPrivacyFilterReplace ¶ added in v1.0.2
func SetPrivacyFilterReplace(b bool)
SetPrivacyFilterReplace replaces the string argument to printf that a Privacy Filter identified with ****s
func SetUseColor ¶ added in v1.0.1
func SetUseColor(useColor bool)
SetUseColor toggles weather color output is used
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a go Logger wrapper that adds log levels and pattern filtering It allows high level 'log level' filtering broadly It allows allows two addition levels of filtering:
everythingFrom which allows inclusion of packages/patterns along with general logging nothingExcept which allows focusing on just listed areas privacyFilters by default apply all functions to printf args and add warnings to them for matches privacyFilterReplace obscures any matches from the privacy filter functions
func NewFile ¶
NewFile returns a new Logger that logs to the supplied file with a filter set to the supplied level
func (*Logger) AddEverythingFromPattern ¶
AddEverythingFromPattern adds a pattern to skip log level filtering, guaranteeing all logs matching the pattern are seen
func (*Logger) AddNothingExceptFilter ¶
AddNothingExceptFilter enables strong filtering showing logs only for things on the approved list, adding this pattern to the list
func (*Logger) AddPrivacyFilter ¶ added in v1.0.2
func (*Logger) ExcludeFromPattern ¶
ExcludeFromPattern adds a pattern to exclude logs from
func (*Logger) Printf ¶
Printf outputs the format and variables, assuming it passes the filter levels
func (*Logger) SetPrivacyFilterReplace ¶ added in v1.0.2
func (*Logger) SetUseColor ¶ added in v1.0.1
SetUseColor toggles weather color output is used