vaughan0/go-logging — pull request #1 by mk-fg (2013-02-01 07:05:30+00:00)
Title: Export variables and methods to allow manual configuration using same concepts as with ini

I'm writing a commandline tool and go-logging seem to provide all the output functionality required in a very convenient package, but I intend to have configuration for the tool to be in YAML format and would like to configure go-logging using "logging" section of that config, which might look roughly like this:

logging:

loggers:
# By default, only messages with a level of INFO or higher will be logged.
# The default output is the "console" output, which will be defined in the next section.
root: DEBUG,console
# Turn off all messages except FATAL ones from any loggers from vaughan0's libraries.
vaughan0: FATAL

# All other sections are output definitions:
console:
type: console
stream: stderr
format: $time $level: ($file:$line) $msg

logfile:
type: file
file: logging-is-fun.txt
format: '$time $level ($logger) $msg'

Unfortunately, current go-logging doesn't seem to provide the necessary functionality to do that, which can be fixed by making some of the interfaces public and then writing function, similar to config.apply method.

08edfa7518 (this PR) makes it possible to do just that, as I did in [this submodule](https://github.com/mk-fg/codetag/blob/master/src/codetag/log_setup/log_setup.go).

For my purposes, ideally, go-logging won't have to depend on go-ini module at all (so that ini-configuration part would be optional), since ini clearly won't be actually used in my case, but I don't consider such separation critical and would like to use upstream go-logging regardless of that extra dep, which this patch would allow me to do.

Of course, I'm not sure if the interfaces in question are considered stable and/or safe to export like that, so feel free to clarify that point and whether you see such "generic configuration" functionality in the module as useful at all (I can try to implement it in any other suggested form).

Note that I'm quite new to Go, so apologies for any obvious errors I might've made there.