|
BDE 4.39.x Production Release
|
Provide a suite of utility functions for category management.
Provide a suite of utility functions for category management.
This component defines a struct, ball::LoggerCategoryUtil, that provides a set of utility functions for managing the categories contained in a ball::LoggerManager based on the notion of hierarchy.
NOTE: The functions in this component forward their calls through ball::LoggerManager to ball::CategoryManager, which contains the implementations of hierarchical category management. See ball_categorymanager for comprehensive documentation on hierarchical category management, including detailed usage examples.
In particular, the setThresholdLevelsHierarchically function modifies the threshold levels of each category whose name has the specified string as a prefix, and the addCategoryHierarchically function creates a new category that inherits threshold levels from the existing category whose name is the longest prefix match, if such a category exists.
The setThresholdLevels function is deprecated in favor of setThresholdLevelsHierarchically. The former is data-sensitive in the sense that the * located at the end of the specified category name will be treated as a special flag to turn on the prefix name matching, thus causing trouble for categories whose name ends with *.
This section illustrates basic usage of this component's functions. For comprehensive usage examples demonstrating hierarchical category management, including inheritance of threshold levels and prefix-based threshold updates, see the "Usage" section in ball_categorymanager .
The following example demonstrates basic usage of addCategoryHierarchically and setThresholdLevelsHierarchically.
First, assume we have initialized the logger manager with default thresholds:
Then, we create a base category:
Next, we use addCategoryHierarchically to create a category that inherits from "EQ":
The new category "EQ.MARKET" will inherit threshold levels [192, 96, 64, 32] from "EQ".
Finally, we update all categories under "EQ" using setThresholdLevelsHierarchically:
This will update threshold levels for both "EQ" and "EQ.MARKET".
For more detailed examples illustrating hierarchical category management, longest prefix matching, and threshold inheritance strategies, see the usage examples in ball_categorymanager .