Skip to content

xissy/logrus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logrus

JSONFormatter for Apex Up

  • Original JSONFormatter
{
  "grpc.code":"OK",
  "grpc.method":"LogIn",
  "grpc.service":"pb.taeho.account.AccountService",
  "grpc.start_time":"2018-03-30T18:02:25-07:00",
  "grpc.time_ms":3.615,
  "level":"info",
  "msg":"finished unary call with code OK",
  "peer.address":"127.0.0.1:62832",
  "span.kind":"server",
  "system":"grpc"
}
  • Apex Up JSONFormatter
{
  "fields":{
    "grpc_code":"OK",
    "grpc_method":"LogIn",
    "grpc_service":"pb.taeho.account.AccountService",
    "grpc_start_time":"2018-03-30T18:02:25-07:00",
    "grpc_time_ms":3.615,
    "peer_address":"127.0.0.1:62832",
    "span_kind":"server",
    "system":"grpc"
  },
  "level":"info",
  "message":"finished unary call with code OK"
}

Usage

package main

import (
    log "github.com/sirupsen/logrus"
    "github.com/xissy/logrus"
)

func main() {
    log.SetOutput(os.Stdout)
    log.SetFormatter(&logrus.ApexUpJSONFormatter{})
    log.WithField("key", "value").Info("message here")
}

References

About

logrus JSONFormatter for Apex Up

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages