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

Detailed Description

Enumerate a set of timezone defaults for log timestamps.

Outline

Purpose

Enumerate a set of timezone defaults for log timestamps.

Classes

Description

This component provides a namespace, ball::RecordFormatterTimezone, for the enum type ball::RecordFormatterTimezone::Enum. Enum enumerates a list of time stamp timezone values that log record formatters may apply.

Usage

This section illustrates intended use of this component.

Example 1: Selecting Timestamp Timezone for Logging

Suppose we are implementing a logging system and need to allow users to configure whether timestamps should be rendered in UTC or local time. We can use ball::RecordFormatterTimezone::Enum to represent this choice.

First, we define a variable to hold the configured timezone setting, defaulting to UTC:

Enum
Timezone setting for timestamps in log record formatters.
Definition ball_recordformattertimezone.h:114
@ e_UTC
Definition ball_recordformattertimezone.h:115

Then, based on user configuration, we might change this to local time:

bool useLocalTime = true; // from user configuration
if (useLocalTime) {
}
@ e_LOCAL
Definition ball_recordformattertimezone.h:116

Finally, we can use this value to control timestamp formatting:

// Format timestamp in local time
}
else {
// Format timestamp in UTC
}

This allows timestamps in log records to be rendered in either UTC (useful for distributed systems and log aggregation) or local time (useful for local debugging and human readability).