Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, args ...interface{})
- func Debugf(ctx context.Context, format string, args ...interface{})
- func Debugln(ctx context.Context, args ...interface{})
- func Deepen(ctx context.Context) context.Context
- func Error(ctx context.Context, args ...interface{})
- func Errorf(ctx context.Context, format string, args ...interface{})
- func Errorln(ctx context.Context, args ...interface{})
- func Fatal(ctx context.Context, args ...interface{})
- func Fatalf(ctx context.Context, format string, args ...interface{})
- func Fatalln(ctx context.Context, args ...interface{})
- func Info(ctx context.Context, args ...interface{})
- func Infof(ctx context.Context, format string, args ...interface{})
- func Infoln(ctx context.Context, args ...interface{})
- func NewContext(ctx context.Context, l *Logger) context.Context
- func Panic(ctx context.Context, args ...interface{})
- func Panicf(ctx context.Context, format string, args ...interface{})
- func Panicln(ctx context.Context, args ...interface{})
- func Prefix() string
- func Print(ctx context.Context, args ...interface{})
- func Printf(ctx context.Context, format string, args ...interface{})
- func Println(ctx context.Context, args ...interface{})
- func RawLog(ctx context.Context, level LogLevel, args ...interface{})
- func RawLogf(ctx context.Context, level LogLevel, format string, args ...interface{})
- func RawLogln(ctx context.Context, level LogLevel, args ...interface{})
- func SetFlags(flags int)
- func SetLevel(level LogLevel)
- func SetLevelColor(level LogLevel, fg, bg ColorCode, font FontCode)
- func SetMessageColor(fg, bg ColorCode, font FontCode)
- func SetOutput(w io.Writer)
- func SetPrefix(prefix string)
- func SetSourceColor(fg, bg ColorCode, font FontCode)
- func SetSourceFormat(format string)
- func SetTimeColor(fg, bg ColorCode, font FontCode)
- func SetTimeFormat(timeFormat string)
- func SetTimeZone(timeZone *time.Location)
- func StackTrace(ctx context.Context)
- func TimeFormat() string
- func TimeZone() *time.Location
- func Trace(ctx context.Context, fnc TraceFunc, args ...interface{}) error
- func Tracef(ctx context.Context, fnc TraceFunc, format string, args ...interface{}) error
- func Traceln(ctx context.Context, fnc TraceFunc, args ...interface{}) error
- func Warn(ctx context.Context, args ...interface{})
- func Warnf(ctx context.Context, format string, args ...interface{})
- func Warnln(ctx context.Context, args ...interface{})
- func Writer() io.Writer
- type ColorCode
- type Colorizer
- func (c *Colorizer) Colorize(message string) string
- func (c *Colorizer) GetBackground() ColorCode
- func (c *Colorizer) GetFont() FontCode
- func (c *Colorizer) GetForeground() ColorCode
- func (c *Colorizer) SetBackground(bg ColorCode) error
- func (c *Colorizer) SetFont(font FontCode) error
- func (c *Colorizer) SetForeground(fg ColorCode) error
- type FontCode
- type LogLevel
- type Logger
- func (l *Logger) Clone() *Logger
- func (l *Logger) Colorize()
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Debugln(args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Errorln(args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Fatalln(args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Infoln(args ...interface{})
- func (l *Logger) Level() LogLevel
- func (l *Logger) LevelColor(level LogLevel) *Colorizer
- func (l *Logger) MakeDefault()
- func (l *Logger) MessageColor() *Colorizer
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Panicln(args ...interface{})
- func (l *Logger) Prefix() string
- func (l *Logger) PrefixColor() *Colorizer
- func (l *Logger) Print(args ...interface{})
- func (l *Logger) Printf(format string, args ...interface{})
- func (l *Logger) Println(args ...interface{})
- func (l *Logger) RawLog(ctx context.Context, level LogLevel, args ...interface{})
- func (l *Logger) RawLogf(ctx context.Context, level LogLevel, format string, args ...interface{})
- func (l *Logger) RawLogln(ctx context.Context, level LogLevel, args ...interface{})
- func (l *Logger) RawStackTrace(ctx context.Context, prefix string)
- func (l *Logger) RawTrace(ctx context.Context, fnc TraceFunc, msg string) error
- func (l *Logger) RawWrite(ctx context.Context, level LogLevel, message string, trace ...string) (int, error)
- func (l *Logger) SetFlags(flags int)
- func (l *Logger) SetLevel(level LogLevel)
- func (l *Logger) SetLevelColor(level LogLevel, fg, bg ColorCode, font FontCode)
- func (l *Logger) SetMessageColor(fg, bg ColorCode, font FontCode)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) SetPrefix(prefix string)
- func (l *Logger) SetPrefixColor(fg, bg ColorCode, font FontCode)
- func (l *Logger) SetSourceColor(fg, bg ColorCode, font FontCode)
- func (l *Logger) SetSourceFormat(format string)
- func (l *Logger) SetTimeColor(fg, bg ColorCode, font FontCode)
- func (l *Logger) SetTimeFormat(timeFormat string)
- func (l *Logger) SetTimeZone(timeZone *time.Location)
- func (l *Logger) SourceColor() *Colorizer
- func (l *Logger) SourceFormat() *SourceFormatter
- func (l *Logger) StackTrace()
- func (l *Logger) TimeColor() *Colorizer
- func (l *Logger) TimeFormat() string
- func (l *Logger) TimeZone() *time.Location
- func (l *Logger) Trace(ctx context.Context, fnc TraceFunc, args ...interface{}) error
- func (l *Logger) Tracef(ctx context.Context, fnc TraceFunc, format string, args ...interface{}) error
- func (l *Logger) Traceln(ctx context.Context, fnc TraceFunc, args ...interface{}) error
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) Warnln(args ...interface{})
- func (l *Logger) WithColor() *Logger
- func (l *Logger) WithFlags(flags int) *Logger
- func (l *Logger) WithLevel(level LogLevel) *Logger
- func (l *Logger) WithLevelColor(level LogLevel, fg, bg ColorCode, font FontCode) *Logger
- func (l *Logger) WithMessageColor(fg, bg ColorCode, font FontCode) *Logger
- func (l *Logger) WithOutput(w io.Writer) *Logger
- func (l *Logger) WithPrefix(prefix string) *Logger
- func (l *Logger) WithPrefixColor(fg, bg ColorCode, font FontCode) *Logger
- func (l *Logger) WithSourceColor(fg, bg ColorCode, font FontCode) *Logger
- func (l *Logger) WithSourceFormat(format string) *Logger
- func (l *Logger) WithTimeColor(fg, bg ColorCode, font FontCode) *Logger
- func (l *Logger) WithTimeFormat(timeFormat string) *Logger
- func (l *Logger) WithTimeZone(timeZone *time.Location) *Logger
- func (l *Logger) WithoutColor() *Logger
- func (l *Logger) Write(data []byte) (int, error)
- func (l *Logger) Writer() io.Writer
- type SourceFormatter
- type SourceRecord
- type TraceFunc
Constants ¶
View Source
const ( ColorDefault = ColorCode("default") ColorBlack = ColorCode("black") ColorRed = ColorCode("red") ColorGreen = ColorCode("green") ColorYellow = ColorCode("yellow") ColorBlue = ColorCode("blue") ColorMagenta = ColorCode("magenta") ColorCyan = ColorCode("cyan") ColorWhite = ColorCode("white") ColorHotPink = ColorCode("hot pink") ColorOrange = ColorCode("orange") ColorPurple = ColorCode("purple") ColorTurquoise = ColorCode("turquoise") ColorLightGray = ColorCode("light gray") ColorDarkGray = ColorCode("dark gray") FontDefault = FontCode(0) FontBold = FontCode(2) FontLight = FontCode(4) FontItalic = FontCode(8) FontUnderline = FontCode(16) FontBlink = FontCode(32) FontReverse = FontCode(128) )
View Source
const (
DefaultTraceID = "xxxxxxxxxxxxx"
)
Variables ¶
This section is empty.
Functions ¶
func SetLevelColor ¶
func SetMessageColor ¶
func SetSourceColor ¶
func SetSourceFormat ¶
func SetSourceFormat(format string)
func SetTimeColor ¶
func SetTimeFormat ¶
func SetTimeFormat(timeFormat string)
func SetTimeZone ¶
func StackTrace ¶
func TimeFormat ¶
func TimeFormat() string
Types ¶
type Colorizer ¶
type Colorizer struct {
// contains filtered or unexported fields
}
func LevelColor ¶
func MessageColor ¶
func MessageColor() *Colorizer
func NewColorizer ¶
func SourceColor ¶
func SourceColor() *Colorizer
func (*Colorizer) GetBackground ¶
func (*Colorizer) GetForeground ¶
func (*Colorizer) SetBackground ¶
func (*Colorizer) SetForeground ¶
type LogLevel ¶
type LogLevel int
func (LogLevel) MarshalJSON ¶
func (LogLevel) PaddedString ¶
func (*LogLevel) UnmarshalJSON ¶
func (*LogLevel) UnmarshalText ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func FromContext ¶
func (*Logger) LevelColor ¶
func (*Logger) MakeDefault ¶
func (l *Logger) MakeDefault()
func (*Logger) MessageColor ¶
func (*Logger) PrefixColor ¶
func (*Logger) SetLevelColor ¶
func (*Logger) SetMessageColor ¶
func (*Logger) SetPrefixColor ¶
func (*Logger) SetSourceColor ¶
func (*Logger) SetSourceFormat ¶
func (*Logger) SetTimeColor ¶
func (*Logger) SetTimeFormat ¶
func (*Logger) SetTimeZone ¶
func (*Logger) SourceColor ¶
func (*Logger) SourceFormat ¶
func (l *Logger) SourceFormat() *SourceFormatter
func (*Logger) StackTrace ¶
func (l *Logger) StackTrace()
func (*Logger) TimeFormat ¶
func (*Logger) WithLevelColor ¶
func (*Logger) WithMessageColor ¶
func (*Logger) WithPrefix ¶
func (*Logger) WithPrefixColor ¶
func (*Logger) WithSourceColor ¶
func (*Logger) WithSourceFormat ¶
func (*Logger) WithTimeColor ¶
func (*Logger) WithTimeFormat ¶
func (*Logger) WithoutColor ¶
type SourceFormatter ¶
type SourceFormatter struct {
// contains filtered or unexported fields
}
func NewSourceFormatter ¶
func NewSourceFormatter(layout string) *SourceFormatter
func SourceFormat ¶
func SourceFormat() *SourceFormatter
func (*SourceFormatter) Format ¶
func (sf *SourceFormatter) Format(skip int) string
type SourceRecord ¶
type SourceRecord struct { PC uintptr FullPath string FileName string BasePath string LineNumber int Package string QualifiedFunction string Receiver string Function string }
func NewSourceRecord ¶
func NewSourceRecord(skip int) *SourceRecord
Click to show internal directories.
Click to hide internal directories.