opensource projects - unders/mywiki GitHub Wiki

Links

Log Now - logn

  • .../logn
  • .../logn/fmtl (format a message)

fmtl.go

type Severity string

const (
       Info Severity = "INFO"
       ...
)

logn.go

type Logger interface {
   Write(r io.Reader)
}


type Formater interface {
   Severity(s Severity) *fmtl.Format
   String(msg string) *fmtl.Format
   Int(msg int) *fmtl.Format
   Err(err error) *ftml.Format
   Context(ctx context.Context) *fmtl.Format

  # io.Reader interface
  Read(p []byte) (n int, err error)
}

Example

log.Write(fmtl.Severity(fmtl.Critical).Err(err))

See zerolog

log.Info().
    Str("foo", "bar").
    Dict("dict", zerolog.Dict().
        Str("bar", "baz").
        Int("n", 1),
    ).Msg("hello world")