Giter Club home page Giter Club logo

logx's Introduction

logx

  • log tool,easy to use,high performance,handy,availability
  • version v1.1

tps

 //OutPut to file
 //tps is : 1400000/s on windows
 //cpu i5-7600 3.5GHZ
 //8GB
 //it will be better on better platform

simple to use

install

go get -u github.com/kafrax/logx

start

package main

import (
    "github.com/kafrax/logx"
)

func main(){
    logx.Debugf("LOGX |message=%v |substring=%s", "logx is a lightweight log to use", "debugf test")
    logx.Infof("LOGX |message=%s", "logx is a lightweight log to use")
    logx.Errorf("LOGX |message=%s", "logx is a lightweight log to use")
    logx.Warnf("LOGX |message=%s", "logx is a lightweight log to use")
    logx.Fatalf("LOGX |message=%s", "logx is a lightweight log to use")
}
[DEBU][08-18.13.34.47.703][main.go|main.main|51] LOGX |message=logx is a lightweight log to use |substring=debugf test
[INFO][08-18.13.34.47.703][main.go|main.main|52] LOGX |message=logx is a lightweight log to use
[ERRO][08-18.13.34.47.703][main.go|main.main|53] LOGX |message=logx is a lightweight log to use
[WARN][08-18.13.34.47.703][main.go|main.main|54] LOGX |message=logx is a lightweight log to use
[FTAL][08-18.13.34.47.703][main.go|main.main|55] LOGX |message=logx is a lightweight log to use

write to file

config logx.json or config.json

  • let logx.json or config.json in your project root dir.
  • will be executed by default , there is no config.json or logx.json yet.
  • notice fileWriter use memory cache ,so must have enough time to do poller to save data to log file.
{
    "llevel":1,        //log level,1debug,2info,3warn,4error,5fatal
    "lmaxsize":256     //256mb
    "lout":"stdout",   //file|stdout
    "lbucketlen":1024, //log message bucket cache size
    "lfilename":"logx",//log file name eg. logx2006-01-02.04.05.000.log
    "lfilepath":"./",  //log file path
    "lpollerinterval": //500 millisecond flush once
}

start

package main

import (
    "github.com/kafrax/logx"
)

func main(){
    logx.Debugf("module=test |message=%s","logx is a lightweight log to use")
    var str string
    fmt.Scan(&str)
}

future

  • data queue send to kafaka

@me

logx's People

Contributors

jinbanglin avatar kafrax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jackywww

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.