Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-global loggers. #13

Merged
merged 11 commits into from
May 11, 2016
Merged

Support non-global loggers. #13

merged 11 commits into from
May 11, 2016

Conversation

ericsnowcurrently
Copy link
Contributor

@ericsnowcurrently ericsnowcurrently commented Apr 28, 2016

This patch allows Logger to be used independent of the process-global state, while maintaining backward-compatibility. Before this patch, Logger was hard-coded to write to the process-global set of log writers. This meant that Logger could not be used independently of the global state, which made it impractical to re-use the Logger's "interface" more generally.

To support non-global loggers, this patch encapsulates the global state of loggo in a couple of new types: Loggers and Writers. Several new interfaces support this encapsulation. Likewise some useful functions are newly exported: NewMinLevelWriter, EffectiveMinLevel, and IsLevelEnabled. More direct use of Logger is supported by NewLogger and NewRootLogger.

In addition to some cleanup, this patch also factors out support for non-global logger config. This is exposed through the new LoggerConfig and LoggersConfig types as well as several factory functions.

A follow-up patch is forthcoming which will add a Record type that simplifies a number of function signatures. That patch will introduce (and work around) several backward incompatibilities. However, this patch maintains backward compatibility for all existing exported types and functions.

(Review request: http://reviews.vapour.ws/r/4725/)

@ericsnowcurrently ericsnowcurrently changed the title Cleanup code in preparation for syslog support. Cleanup code and support loggers independent from the global state. May 11, 2016
@ericsnowcurrently ericsnowcurrently changed the title Cleanup code and support loggers independent from the global state. Support loggers independent from the global state. May 11, 2016
@ericsnowcurrently ericsnowcurrently changed the title Support loggers independent from the global state. Support non-global loggers. May 11, 2016
@ericsnowcurrently
Copy link
Contributor Author

$$merge$$

@jujubot
Copy link
Contributor

jujubot commented May 11, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-loggo

@jujubot jujubot merged commit 0e0537f into juju:master May 11, 2016
@ericsnowcurrently ericsnowcurrently deleted the cleanup branch May 11, 2016 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants