Documentation ¶
Index ¶
- Constants
- Variables
- func ColorByMethod(cond bool, method string) string
- func ColorByStatus(cond bool, code int) string
- func FormatHeader(buffer *bytes.Buffer, prefix string, t time.Time) int
- func NewAnsiColorWriter(w io.Writer) io.Writer
- func NewIoLogWriter(wr io.Writer) *ioWriter
- func NewModeAnsiColorWriter(w io.Writer, mode outputMode) io.Writer
- func Register(adaptername string, adapterFn newLoggerFunc)
- func W32Debug(msg string)
- type Component
- type ILogger
- type LogWrap
- type PBLogWriter
- type StrEncoder
- func (s StrEncoder) EncodeBool(key string, val bool)
- func (s StrEncoder) EncodeDuration(key string, val time.Duration)
- func (s StrEncoder) EncodeFloat64(key string, val float64)
- func (s StrEncoder) EncodeInt(key string, val int)
- func (s StrEncoder) EncodeInt64(key string, val int64)
- func (s StrEncoder) EncodeObject(key string, val interface{})
- func (s StrEncoder) EncodeString(key string, val string)
- func (s StrEncoder) EncodeType(key string, val reflect.Type)
- func (s StrEncoder) EncodeUint(key string, val uint)
- func (s StrEncoder) EncodeUint64(key string, val uint64)
Constants ¶
const ( DiscardNonColorEscSeq outputMode OutputNonColorEscSeq )
DiscardNonColorEscSeq supports the divided color escape sequence. But non-color escape sequence is not output. Please use the OutputNonColorEscSeq If you want to output a non-color escape sequences such as ncurses. However, it does not support the divided color escape sequence.
const ( AdapterConsole = "console" AdapterFile = "file" AdapterRemote = "remote" )
Variables ¶
var (
LevelPrefix = [log.LevelFatal + 1]string{"[D]", "[I]", "[W]", "[E]", "[P]", "[F]"}
)
Functions ¶
func ColorByMethod ¶
ColorByMethod return color by http code GET return Blue POST return Cyan PUT return Yellow DELETE return Red PATCH return Green HEAD return Magenta OPTIONS return WHITE
func ColorByStatus ¶
ColorByStatus return color by http code 2xx return Green 3xx return White 4xx return Yellow 5xx return Red
func NewAnsiColorWriter ¶
NewAnsiColorWriter creates and initializes a new ansiColorWriter using io.Writer w as its initial contents. In the console of Windows, which change the foreground and background colors of the text by the escape sequence. In the console of other systems, which writes to w all text.
func NewIoLogWriter ¶
func NewModeAnsiColorWriter ¶
NewModeAnsiColorWriter create and initializes a new ansiColorWriter by specifying the outputMode.
Types ¶
type Component ¶
type Component struct {
component.DefaultComponent
}
type ILogger ¶
type ILogger interface { Init(configor pbconfig.Configor) error SetLogLevel(level log.Level) WriteLog(logname, msg string, level log.Level, when time.Time, context, fields []log.Field) Destroy() }
func NewConsole ¶
func NewConsole() ILogger
NewConsole create ConsoleWriter returning as LoggerInterface.
type PBLogWriter ¶
type PBLogWriter struct {
// contains filtered or unexported fields
}
func NewLogWriter ¶
func NewLogWriter(logWriterName string, configor pbconfig.Configor) (*PBLogWriter, error)
func (*PBLogWriter) Adapter ¶
func (lw *PBLogWriter) Adapter() string
func (*PBLogWriter) Destroy ¶
func (lw *PBLogWriter) Destroy()
func (*PBLogWriter) LogLevel ¶
func (lw *PBLogWriter) LogLevel() log.Level
func (*PBLogWriter) Name ¶
func (lw *PBLogWriter) Name() string
type StrEncoder ¶
type StrEncoder struct {
// contains filtered or unexported fields
}
func (StrEncoder) EncodeBool ¶
func (s StrEncoder) EncodeBool(key string, val bool)
func (StrEncoder) EncodeDuration ¶
func (s StrEncoder) EncodeDuration(key string, val time.Duration)
func (StrEncoder) EncodeFloat64 ¶
func (s StrEncoder) EncodeFloat64(key string, val float64)
func (StrEncoder) EncodeInt ¶
func (s StrEncoder) EncodeInt(key string, val int)
func (StrEncoder) EncodeInt64 ¶
func (s StrEncoder) EncodeInt64(key string, val int64)
func (StrEncoder) EncodeObject ¶
func (s StrEncoder) EncodeObject(key string, val interface{})
func (StrEncoder) EncodeString ¶
func (s StrEncoder) EncodeString(key string, val string)
func (StrEncoder) EncodeType ¶
func (s StrEncoder) EncodeType(key string, val reflect.Type)
func (StrEncoder) EncodeUint ¶
func (s StrEncoder) EncodeUint(key string, val uint)
func (StrEncoder) EncodeUint64 ¶
func (s StrEncoder) EncodeUint64(key string, val uint64)