public final class LogPolicyProperties extends Object implements LogPolicyType
Log policy based on Properties.
The default enabled/disabled state for log interfaces are parsed from the
given properties using a prefix. Specific interfaces effectively
inherit their default enabled/disabled state from their closest ancestor.
So, if an interface named main is set to be disabled by
default, then an interface named main.a will also be disabled
by default.
As an example, given the prefix com.io7m.tests and the
following properties:
com.io7m.tests.level = LOG_DEBUG com.io7m.tests.logs = true com.io7m.tests.logs.main = true com.io7m.tests.logs.main.a = false com.io7m.tests.logs.main.b.a = false
The initial log level will be LogLevel.LOG_DEBUG, an interface
named main will be disabled by default, as will
main.a and main.b.a. However, there is no
specific entry for an interface main.b, and the closest
ancestor of main.b is main, so
main.b will inherit main's default state and will
be enabled by default. If there is no ancestor, the default value is used,
specified by com.io7m.tests.logs.
| Modifier and Type | Method and Description |
|---|---|
static LogPolicyType |
newPolicy(Properties props,
String property_prefix)
Construct a new log policy, reading properties prefixed with
property_prefix from props. |
LogLevel |
policyDefaultLevel() |
boolean |
policyDestinationEnabled(String destination) |
public static LogPolicyType newPolicy(Properties props, String property_prefix) throws com.io7m.jproperties.JPropertyException
Construct a new log policy, reading properties prefixed with
property_prefix from props.
props - The properties.property_prefix - The property prefix.com.io7m.jproperties.JPropertyException - If the given properties are invalid.public LogLevel policyDefaultLevel()
policyDefaultLevel in interface LogPolicyTypepublic boolean policyDestinationEnabled(String destination)
policyDestinationEnabled in interface LogPolicyTypedestination - The destination.true if logging to the given absolute destination is
enabled by the policy.Copyright © 2014 <code@io7m.com> http://io7m.com