jcelliott / lumber

A simple logger for Go
MIT License
63 stars 16 forks source link

adding new Is* methods that can be used to check log level to ensure log args aren't evaluated in certain conditions #3

Closed sjhitchner closed 10 years ago

sjhitchner commented 10 years ago

This methods will be useful so that more involved logging can be turned on when the code is in a lower debug state

i.e.
JSON serialized Request and Response objects when in debugging mode, which won't be logged when in production.

if log.IsTrace() { b, _ := json.MarshalIdent(struct), "", " ") log.Trace(string(b)) }

jcelliott commented 10 years ago

Thanks, I like the idea. I'll try to merge it in later today or tomorrow.

sjhitchner commented 10 years ago

cool, glad you like the changes

jcelliott commented 10 years ago

Sorry it took so long to merge this in, I completely forgot about it until just now. Feel free to open issues with any other suggestions.