Git Product home page Git Product logo

golog's Introduction

fslog

Golang日志包,基于zap二次封装,开箱即用

特性

  • 支持多级别打印:Debug、Info、Warn、Error
  • 支持日志文件切割
  • 支持用户自定义zap二次开发
  • 快捷的gin框架日志输出接入
  • 运行时动态修改配置特性
  • 日志多输出源支持
  • 属性快照打印支持

打印

默认的可以直接打印字符串,如果需要模板字符串支持直接拼接参数即可(用法与fmt.Sprintf相同)。 如果需要查看当前环境下变量信息,则可以使用With方法,打印时信息中会包含With方法中的字段信息。 Error支持字符串、格式化字符串、error类型,如果时error类型,会自动打印堆栈信息。

package main

import (
	"errors"
    "github.com/yushengji/fslog"
)

func main() {
    fslog.Debug("this is a debug log")
    fslog.Info("support %s log", "info")
    fslog.With("field", 1).Warn("this is a warn log")
    fslog.Error(errors.New("this is a error"))
}

性能

11th i7 16G Golang 1.22版本下,输出源仅为控制台: 32.5 ns/op 1 allocs/op

golog's People

Contributors

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