Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xissy/logrus
logrus JSONFormatter for Apex Up
https://github.com/xissy/logrus
apex-up grpc-middleware logrus
Last synced: 15 days ago
JSON representation
logrus JSONFormatter for Apex Up
- Host: GitHub
- URL: https://github.com/xissy/logrus
- Owner: xissy
- Created: 2018-03-31T01:05:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-18T02:53:05.000Z (over 6 years ago)
- Last Synced: 2024-10-27T13:10:36.062Z (2 months ago)
- Topics: apex-up, grpc-middleware, logrus
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# logrus
## JSONFormatter for Apex Up
* Original JSONFormatter
```json
{
"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
```json
{
"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
```go
package mainimport (
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
* https://github.com/sirupsen/logrus
* https://github.com/apex/up
* https://github.com/grpc-ecosystem/go-grpc-middleware