Documentation ¶
Overview ¶
The oryx logger package provides connection-oriented log service.
logger.I(ctx, ...) logger.T(ctx, ...) logger.W(ctx, ...) logger.E(ctx, ...)
Or use format:
logger.If(ctx, format, ...) logger.Tf(ctx, format, ...) logger.Wf(ctx, format, ...) logger.Ef(ctx, format, ...)
@remark the Context is optional thus can be nil. @remark From 1.7+, the ctx could be context.Context, wrap by logger.WithContext,
please read ExampleLogger_ContextGO17().
Index ¶
- func AliasContext(parent context.Context, source context.Context) context.Context
- func Close() (err error)
- func E(ctx Context, a ...interface{})
- func Ef(ctx Context, format string, a ...interface{})
- func I(ctx Context, a ...interface{})
- func If(ctx Context, format string, a ...interface{})
- func Switch(w io.Writer) io.Writer
- func T(ctx Context, a ...interface{})
- func Tf(ctx Context, format string, a ...interface{})
- func W(ctx Context, a ...interface{})
- func Wf(ctx Context, format string, a ...interface{})
- func WithContext(ctx context.Context) context.Context
- type Context
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AliasContext ¶ added in v0.0.2
Create context with value from parent, copy the cid from source context. @remark Create new cid if source has no cid represent.
func Close ¶
func Close() (err error)
The interface io.Closer Cleanup the logger, discard any log util switch to fresh writer.
Types ¶
type Context ¶
type Context interface{}
The context for current goroutine. It maybe a cidContext or context.Context from GO1.7. @remark Use logger.WithContext(ctx) to wrap the context.
type Logger ¶
type Logger interface { // Println for logger plus, // @param ctx the connection-oriented context, // or context.Context from GO1.7, or nil to ignore. Println(ctx Context, a ...interface{}) Printf(ctx Context, format string, a ...interface{}) }
The logger for oryx.
var Error Logger
Error, the error level, fatal error things, ot Stdout.
var Info Logger
Info, the verbose info level, very detail log, the lowest level, to discard.
var Trace Logger
Trace, the trace level, something important, the default log level, to stdout.
var Warn Logger
Warn, the warning level, dangerous information, to Stdout.