BDE 4.39.x Production Release
Loading...
Searching...
No Matches
ball_loggercategoryutil

Detailed Description

Provide a suite of utility functions for category management.

Outline

Purpose

Provide a suite of utility functions for category management.

Classes

See also
ball_loggermanager, ball_categorymanager

Description

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.

Deprecation Notice

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 *.

Usage

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 .

Example 1: Basic Hierarchical Category Operations

The following example demonstrates basic usage of addCategoryHierarchically and setThresholdLevelsHierarchically.

First, assume we have initialized the logger manager with default thresholds:

lm.setDefaultThresholdLevels(191, 95, 63, 31);
Definition ball_loggermanager.h:1293
int setDefaultThresholdLevels(int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
Definition ball_loggermanager.h:2488
static LoggerManager & singleton()
Definition ball_loggermanager.h:2389

Then, we create a base category:

lm.addCategory("EQ", 192, 96, 64, 32);
Category * addCategory(const char *categoryName, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
Definition ball_loggermanager.h:2464

Next, we use addCategoryHierarchically to create a category that inherits from "EQ":

static Category * addCategoryHierarchically(LoggerManager *loggerManager, const char *categoryName)
Definition ball_loggercategoryutil.h:224

The new category "EQ.MARKET" will inherit threshold levels [192, 96, 64, 32] from "EQ".

Finally, we update all categories under "EQ" using setThresholdLevelsHierarchically:

"EQ",
194,
98,
66,
34);
static int setThresholdLevelsHierarchically(LoggerManager *loggerManager, const char *categoryNamePrefix, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
Definition ball_loggercategoryutil.h:234

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 .