Giter Club home page Giter Club logo

logger's People

Contributors

bitspill avatar cathalgarvey avatar nym3r0s avatar

Stargazers

 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

logger's Issues

Regression in latest version (71c896b)

Running the example code:

package main

import (
    "github.com/azer/logger"
    "time"
)

var log = logger.New("app")

func main() {
    log.Info("Starting at %d", 9088)

    log.Info("Requesting an image at foo/bar.jpg")
    timer := log.Timer()
    time.Sleep(time.Millisecond * 250)
    timer.End("Fetched foo/bar.jpg")

    log.Error("Failed to start, shutting down...")
}

with version 71c896b yields the following error:

panic: assignment to entry in nil map

goroutine 1 [running]:
panic(0xc58e0, 0xc820064050)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
/vendor/github.com/azer/logger.New(0x10baf8, 0x3, 0xc820050000)
    /vendor/github.com/azer/logger/logger.go:26 +0xaa
main.init()
    /example.go:8 +0x65
exit status 2

Reverting to d8432cee resolves the issue:

11:39:22.887 app: Starting at 9088
11:39:22.887 app: Requesting an image at foo/bar.jpg
11:39:23.142 app(254.627113ms): Fetched foo/bar.jpg
11:39:23.142 app(!): Failed to start, shutting down...

Public access to `enabled` map

Hey, this logger looks great- a good blend of simple API, levelling/app-segregation, and nice design.

One feature I'd really like, though, is the ability to programmatically enable logs and log levels, rather than relying on the environment variable method. If I'm already defining a CLI interface for my application I'd prefer to add a "-v" / "-vv" flag to enable various log levels or log types.

It looks like this would be easy to do if the "enabled" map were exposed publicly. Alternatively, if a setter function were added to complement IsEnabled, so you could call a function with a logger name and a state to enable. Something like SetEnabled(logname string, setstate bool) error.

I can write it up and PR, if you like?

License ?

Hello, under what license is this project released under ? Thank-you.

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.