rs / xlog

xlog is a logger for net/context aware HTTP applications
MIT License
139 stars 13 forks source link

Simple code does not output anything #4

Closed trong closed 8 years ago

trong commented 8 years ago

The code below does not output anything

package main 

import (
    "github.com/rs/xlog"
)

func main() {
    l := xlog.New(xlog.Config{})
    l.Infof("%s", "INFO")
}

Could you say - whats is wrong?

rs commented 8 years ago

By default the output is wrapped into a OutputChannel so there is a buffered channel between the logger and the output. It’s well suited for http handler so logging output I/O can never block your handlers.

When used like that, your program will exit before the buffered channel is actually flushed and delivered to the output.

trong commented 8 years ago

Ok, thanks!