Giter Site home page Giter Site logo

glog's Introduction

glog

日志库 实现了 文件按天按大小分割 配置文件热更新 可同时写入多个文件方便接入其他日志系统

配置文件使用json

{
    "Layouts":
    [
        {
            "Serializer":{"Type":"json"},
            "Target":{"Type":"file"}
        }
    ],
    "Async":false
}

使用Layouts数组来支持多个文件的输出
配合file Target字段的MinLevel 和MaxLevel可以把 不同级别的日志输出到不同的文件
file Target支持的字段参照target.go createFileTarget

通过NewManager->GetLogger来获取logger 就可以打印日志 通常1个程序只需要1个manager

Serializer 目前支持plain 和json
自定义Serializer
1.实现Serializer
2.RegisterSerializer(key, Serializer)
3.在配置文件中Serializer的Type字段中指定同样的key
4.NewManager

Target 目前支持file console
fileTarget 使用异步写入日志 Async字段为true时 异步序列化 否则同步序列化
自定义Target
1.实现TargetCtor
2.RegisterTarget(key, TargetCtor)
3.在配置文件中Target的Type字段指定同样的key
4.NewManager

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.