|
BDE 4.14.0 Production release
|
Provide a set of unique rules.
This component provides a value-semantic container, ball::RuleSet, for storage and efficient retrieval of ball::Rule objects.
This component participates in the implementation of "Rule-Based Logging". For more information on how to use that feature, please see the package level documentation and usage examples for "Rule-Based Logging".
ball::RuleSet is not thread-safe in that multiple threads attempting to concurrently modify the same ball::RuleSet object will leave the object in an undefined state. To ensure thread-safety, concurrent accesses to a ball::RuleSet must be serialized by a mutex.
The following code fragments illustrate how to use a rule set.
We first create a rule whose pattern is WEEKEND* and whose threshold levels are all ball::Severity::e_OFF except the pass-through level. A pass-through level of ball::Severity::e_INFO indicates that whenever the rule is active and the severity equals or exceeds ball::Severity::e_INFO, log records will be passed to the observer:
Next, we create another rule having a different pattern, but the same threshold levels:
We then create a ball::RuleSet object, add the two rules, and verify that rules were added correctly:
Duplicate rules cannot be added:
Rules in a rule set can be looked up by the ruleId method:
The removeRule method can be used to remove rules from a rule set.