Documentation
¶
Overview ¶
Package logger provides standard logger for OpenPitrix.
Example ¶
package main import ( "openpitrix.io/logger" ) func main() { logger.Infof(nil, "hello openpitrix") }
Example (WithContext) ¶
package main import ( "context" "openpitrix.io/logger" "openpitrix.io/logger/ctxutil" ) func main() { ctx := context.Background() ctx = ctxutil.SetRequestId(ctx, "req-id-001") ctx = ctxutil.SetMessageId(ctx, "msg-001", "msg-002") logger.Infof(ctx, "hello openpitrix") }
Index ¶
- func Criticalf(ctx context.Context, format string, a ...interface{})
- func Debugf(ctx context.Context, format string, a ...interface{})
- func Errorf(ctx context.Context, format string, a ...interface{})
- func HideCallstack()
- func Infof(ctx context.Context, format string, a ...interface{})
- func SetLevelByString(level string)
- func SetOutput(output io.Writer)
- func ShowCallstack()
- func Warnf(ctx context.Context, format string, a ...interface{})
- type Level
- type Logger
- func (p *Logger) Criticalf(ctx context.Context, format string, args ...interface{})
- func (p *Logger) Debugf(ctx context.Context, format string, a ...interface{})
- func (p *Logger) Errorf(ctx context.Context, format string, args ...interface{})
- func (p *Logger) HideCallstack() *Logger
- func (p *Logger) Infof(ctx context.Context, format string, a ...interface{})
- func (p *Logger) SetLevel(level Level)
- func (p *Logger) SetLevelByString(level string)
- func (p *Logger) SetOutput(w io.Writer) *Logger
- func (p *Logger) ShowCallstack() *Logger
- func (p *Logger) Warnf(ctx context.Context, format string, a ...interface{})
- func (p *Logger) WithDepth(depth int) *Logger
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HideCallstack ¶
func HideCallstack()
func SetLevelByString ¶
func SetLevelByString(level string)
func ShowCallstack ¶
func ShowCallstack()
Types ¶
type Logger ¶
type Logger struct { Level Level // contains filtered or unexported fields }
func (*Logger) HideCallstack ¶
func (*Logger) SetLevelByString ¶
func (*Logger) ShowCallstack ¶
Click to show internal directories.
Click to hide internal directories.