loggo
loggo copied to clipboard
Config loggers by labels
To support labels from Juju, we would like to be able to configure loggers by their labels. So if a logger has a label of a model namespace (UUID) then searching from the root module to set the level of a module should be possible.
Label matching can be applied to the loggers by providing a set of labels to the ConfigureLoggers method. If a logger has a label that matches the provided labels, then the logger will be configured with the provided level. If the logger does not have a label that matches the provided labels, then the logger will not be configured. No labels will configure all loggers in the specification.
In addition, I've removed the attachment of the dynamic labels to the logger type. There isn't a usage from Juju's perspective to ever need them. Loggo is a hierarchical model, where loggers inherit from their parents. The original label concept didn't follow that concept. For example, module names walk their parents for an effective level if a level hasn't been set. We do the inverse for labels, where the parent sets the child labels on construction (labels are immutable atm), but they do follow the same concept; child-parent relationship.