Code Monkey home page Code Monkey logo

log's Introduction

Log

基础于uber的高性能日志zap。已封装对控制台以及文件的支持。

go get github.com/tnngo/log

示例

快速使用:

log.NewSimple()
log.L().Debug("这是debug信息", zap.String("hello","golang"))

日志文件:

opt := &Options{
	File: &FileCfg{
		Filename:   "test.log", // 文件名称。
		MaxSize:    512, // 最大尺寸MB,该示例表示512MB。
		MaxBackups: 100, // 最大备份数量,该示例表示100个。
		MaxAge:     30, // 最大保存时间,该示例表示30天。
		Compress:   true, // 是否压缩打包,该示例表示打包。
	},
}

log.New(opt)
// 使用默认打印方式,打印信息和参数信息都是零拷贝实现。
log.L().Info("这是debug信息", zap.String("hello","golang"))

默认日志级别

控制台: DEBUG。
文件: INFO。

log's People

Watchers

tnngo 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.