GithubHelp home page GithubHelp logo

nuveo / log Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 4.0 49 KB

A simple to use log system, minimalist but with features for debugging and differentiation of messages

License: MIT License

Go 98.74% Shell 1.26%
golang golang-library golang-package log logger logging

log's People

Contributors

arxdsilva avatar avelino avatar cassiobotaro avatar crgimenes avatar eltonsouza avatar ervilis avatar felipeweb avatar jtemporal avatar lerrua avatar marioidival avatar rogeriozambon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

log's Issues

limit the size of log lines

If the size of the output line is greater than the size indicated by a configuration variable the log line is cut and them adds "..." at the end.

The default value for the maximum line length is 2000 characters (equivalent to a 25-line, 80-column display)

Support for change output time format

The output time is hard coded defined to use the 0000/00/00 00: 00: 00 format. I want to be able to format it any way I want.

My idea:

import (
	"github.com/nuveo/log"
}

func init {
	log.Settings.TimestampFormat = "0000-00-00T00:00:00.0000"
}

func main {}

Support for JSON output format

Sometimes we need to use JSON format logs for some reasons. In my case I want to use it because I use Filebeat together with Logstash, so I can see the logs on Kibana.

My ideia is implement something like this:

import (
	"github.com/nuveo/log"
}

type MyStruct struct {
	// ...
}

func init {
	log.OutputFormat = log.JSONOutputFormat
}

func main {
	log.Debugln(MyStruct{...})
}

Result

{
	"datetime": "2017-08-01T00:00:00.0000",
	"data": {
		"MyStruct here"
	}
}

Problema Timezone

linha 202 e 209: now().UTC().Format(TimeFormat) isso está matando o timezone e definindo tudo com UTC,

removi a função do UTC e ficou assim now().Format(TimeFormat), ai ele manteve o timezone padrao.

export the standard adapter

Hey!

I'm writing a adapter to use the log pkg instead of fmt, so I can redirect it to a buffer and test it, and I stepped into a 'problem' which are represented by these steps:

  • I can add the new adapter,
  • I can remove the standard adapter
  • cannot set the adapter back to the standard adapter

So I believe that the best behavior would be to export it, so we can use it outside.

Tests is not passing on master

When I run tests on master I receive the following error:

--- FAIL: TestLog (0.00s)
	log_test.go:97: Error, 'Debugln' printed "\x1b[96m2017/06/25 15:49:04 [debug] log_test.go:77 log test\x1b[0;00m\n", not match with expected
FAIL

Add usage example

This package is cool, but have no usage examples. We need to add some usage examples.

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.