Code Monkey home page Code Monkey logo

zlog's Introduction

zlog 日志模块

使用zap封装的log模块,可同时输出控制台和日志文件 目前支持两种编码模式, consolejson; 可在配置文件中设置 Encoder 修改;

console

[2022-06-21 18:39:40]   [info]  [main.main:36]  Start Web Server 
[2022-06-21 18:42:00]   [info]  [fly/example/api/example/controller.Hello:21]   [X-Request-Id:62b659cd-373a-49e2-82dc-e63cac629a84]    hello, 司马老贼
[2022-06-21 18:42:00]   [info]  [fly/pkg/httpcode.(*Req).Code:50]       [X-Request-Id:62b659cd-373a-49e2-82dc-e63cac629a84]    api: /v1/hello, run: 330.125µs, param: {"name":"司马老贼"}, code: 200

json

{"level":"info","ts":"2022-06-21 18:43:09","caller":"main.main:36","msg":"Start Web Server "}
{"level":"info","ts":"2022-06-21 18:43:13","caller":"fly/example/api/example/controller.Hello:21","msg":"hello, 司马老贼","X-Request-Id":"2e33e08f-4fe9-4424-aeb5-c26151559143"}
{"level":"info","ts":"2022-06-21 18:43:13","caller":"fly/pkg/httpcode.(*Req).Code:50","msg":"api: /v1/hello, run: 305.458µs, param: {\"name\":\"司马老贼\"}, code: 200","X-Request-Id":"2e33e08f-4fe9-4424-aeb5-c26151559143"}

zlog's People

Contributors

zhaorx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.