BDE 4.39.x Production Release
Loading...
Searching...
No Matches
ball_recordformattertimezone.h
Go to the documentation of this file.
1/// @file ball_recordformattertimezone.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// ball_recordformattertimezone.h -*-C++-*-
8#ifndef INCLUDED_BALL_RECORDFORMATTERTIMEZONE
9#define INCLUDED_BALL_RECORDFORMATTERTIMEZONE
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup ball_recordformattertimezone ball_recordformattertimezone
15/// @brief Enumerate a set of timezone defaults for log timestamps.
16/// @addtogroup bal
17/// @{
18/// @addtogroup ball
19/// @{
20/// @addtogroup ball_recordformattertimezone
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#ball_recordformattertimezone-purpose"> Purpose</a>
25/// * <a href="#ball_recordformattertimezone-classes"> Classes </a>
26/// * <a href="#ball_recordformattertimezone-description"> Description </a>
27/// * <a href="#ball_recordformattertimezone-usage"> Usage </a>
28/// * <a href="#ball_recordformattertimezone-example-1-selecting-timestamp-timezone-for-logging"> Example 1: Selecting Timestamp Timezone for Logging </a>
29///
30/// # Purpose {#ball_recordformattertimezone-purpose}
31/// Enumerate a set of timezone defaults for log timestamps.
32///
33/// # Classes {#ball_recordformattertimezone-classes}
34///
35/// - ball::RecordFormatterTimezone: namespace for enumerating timezones
36///
37/// # Description {#ball_recordformattertimezone-description}
38/// This component provides a namespace,
39/// `ball::RecordFormatterTimezone`, for the `enum` type
40/// `ball::RecordFormatterTimezone::Enum`. `Enum` enumerates a
41/// list of time stamp timezone values that log record formatters may apply.
42///
43/// ## Usage {#ball_recordformattertimezone-usage}
44///
45///
46/// This section illustrates intended use of this component.
47///
48/// ### Example 1: Selecting Timestamp Timezone for Logging {#ball_recordformattertimezone-example-1-selecting-timestamp-timezone-for-logging}
49///
50///
51/// Suppose we are implementing a logging system and need to allow users to
52/// configure whether timestamps should be rendered in UTC or local time. We
53/// can use `ball::RecordFormatterTimezone::Enum` to represent this choice.
54///
55/// First, we define a variable to hold the configured timezone setting,
56/// defaulting to UTC:
57/// @code
58/// ball::RecordFormatterTimezone::Enum timezone =
59/// ball::RecordFormatterTimezone::e_UTC;
60/// @endcode
61/// Then, based on user configuration, we might change this to local time:
62/// @code
63/// bool useLocalTime = true; // from user configuration
64///
65/// if (useLocalTime) {
66/// timezone = ball::RecordFormatterTimezone::e_LOCAL;
67/// }
68/// @endcode
69/// Finally, we can use this value to control timestamp formatting:
70/// @code
71/// if (ball::RecordFormatterTimezone::e_LOCAL == timezone) {
72/// // Format timestamp in local time
73/// }
74/// else {
75/// // Format timestamp in UTC
76/// }
77/// @endcode
78/// This allows timestamps in log records to be rendered in either UTC (useful
79/// for distributed systems and log aggregation) or local time (useful for
80/// local debugging and human readability).
81/// @code
82/// assert(ball::RecordFormatterTimezone::e_LOCAL == timezone);
83/// @endcode
84/// @}
85/** @} */
86/** @} */
87
88/** @addtogroup bal
89 * @{
90 */
91/** @addtogroup ball
92 * @{
93 */
94/** @addtogroup ball_recordformattertimezone
95 * @{
96 */
97
98#include <balscm_version.h>
99
100
101namespace ball {
102
103 // ==============================
104 // struct RecordFormatterTimezone
105 // ==============================
106
107/// This struct provides a namespace for enumerating timezone values for
108/// timestamps in record formatters.
109///
110/// See @ref ball_recordformattertimezone
112
113 /// Timezone setting for timestamps in log record formatters.
114 enum Enum {
115 e_UTC, // Use UTC timezone for timestamp
116 e_LOCAL // Use local timezone for timestamp
117 };
118};
119
120} // close package namespace
121
122
123#endif // INCLUDED_BALL_RECORDFORMATTERTIMEZONE
124
125// ----------------------------------------------------------------------------
126// Copyright 2025 Bloomberg Finance L.P.
127//
128// Licensed under the Apache License, Version 2.0 (the "License");
129// you may not use this file except in compliance with the License.
130// You may obtain a copy of the License at
131//
132// http://www.apache.org/licenses/LICENSE-2.0
133//
134// Unless required by applicable law or agreed to in writing, software
135// distributed under the License is distributed on an "AS IS" BASIS,
136// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137// See the License for the specific language governing permissions and
138// limitations under the License.
139// ----------------------------- END-OF-FILE ----------------------------------
140
141/** @} */
142/** @} */
143/** @} */
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition ball_administration.h:214
Definition ball_recordformattertimezone.h:111
Enum
Timezone setting for timestamps in log record formatters.
Definition ball_recordformattertimezone.h:114
@ e_UTC
Definition ball_recordformattertimezone.h:115
@ e_LOCAL
Definition ball_recordformattertimezone.h:116