• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

TsErrataUtil.h

Go to the documentation of this file.
00001 /** @file
00002 
00003     TS Configuration utilities for Errata and logging.
00004 
00005     @section license License
00006 
00007     Licensed to the Apache Software Foundation (ASF) under one
00008     or more contributor license agreements.  See the NOTICE file
00009     distributed with this work for additional information
00010     regarding copyright ownership.  The ASF licenses this file
00011     to you under the Apache License, Version 2.0 (the
00012     "License"); you may not use this file except in compliance
00013     with the License.  You may obtain a copy of the License at
00014 
00015     http://www.apache.org/licenses/LICENSE-2.0
00016 
00017     Unless required by applicable law or agreed to in writing, software
00018     distributed under the License is distributed on an "AS IS" BASIS,
00019     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020     See the License for the specific language governing permissions and
00021     limitations under the License.
00022  */
00023 
00024 # if !defined(TS_ERRATA_UTIL_HEADER)
00025 # define TS_ERRATA_UTIL_HEADER
00026 
00027 // TBD: Need to do something better than this to get around using
00028 // 'DEBUG' as the name of a constant.
00029 # if defined DEBUG
00030 # undef DEBUG
00031 # define DEBUG DEBUG
00032 # endif
00033 
00034 # include <Errata.h>
00035 
00036 namespace ts { namespace msg {
00037 
00038 /// @name Message severity levels.
00039 //@{
00040 extern Errata::Code FATAL; ///< Fatal, cannot continue.
00041 extern Errata::Code WARN; ///< Significant, function degraded.
00042 extern Errata::Code INFO; ///< Interesting, not necessarily a problem.
00043 extern Errata::Code DEBUG; ///< Debugging information.
00044 //@}
00045 
00046 /** Logging / reporting support.
00047     We build on top of @c Errata but we want to be able to prevent
00048     message generation / allocation for messages with severity levels
00049     less than a run time controllable value.
00050 
00051     @internal Far from complete but serving as a prototype / experiment
00052     to learn what's actually useful.
00053 */
00054 //@{
00055 /// Report literal string to an Errata.
00056 /// @return @a err.
00057 Errata& log(
00058   Errata& err,///< Target errata.
00059   Errata::Id id, ///< Message ID.
00060   Errata::Code code, ///< Severity level.
00061   char const* text ///< Message text.
00062 );
00063 /// Report literal string to an Errata.
00064 /// Use message ID 0.
00065 /// @return @a err.
00066 Errata& log(
00067     Errata& err,///< Target errata.
00068     Errata::Code code, ///< Severity level.
00069     char const* text ///< Message text.
00070 );
00071 /// Report literal string to a return value.
00072 /// Use message ID 0.
00073 /// @return The @c Errata in @a rv.
00074 Errata& log(
00075     RvBase& rv,///< Return value.
00076     Errata::Code code, ///< Severity level.
00077     char const* text ///< Message text.
00078 );
00079 /// printf style log to Errata.
00080 /// @return @a err.
00081 Errata& logf(
00082   Errata& err,///< Target errata.
00083   Errata::Id id, ///< Message ID.
00084   Errata::Code code, ///< Severity level.
00085   char const* format, ///< Format string.
00086   ... ///< Format string parameters.
00087 );
00088 /// printf style log to Errata.
00089 /// The message id is set to zero.
00090 /// @return @a err.
00091 Errata& logf(
00092   Errata& err,///< Target errata.
00093   Errata::Code code, ///< Severity level.
00094   char const* format, ///< Format string.
00095   ... ///< Format string parameters.
00096 );
00097 /// Return an Errata in a return value populated with a printf style formatted string.
00098 /// Use message ID 0.
00099 /// @return The @c Errata in @a rv.
00100 Errata& logf(
00101     RvBase& rv, ///< Rv value.
00102     Errata::Code code, ///< Severity level.
00103     char const* format, ///< Message text.
00104     ...
00105 );
00106 /// Return an Errata populated with a literal string.
00107 /// Use message ID 0.
00108 /// @return @a err.
00109 Errata log(
00110   Errata::Code code, ///< Severity level.
00111   char const* text ///< Message text.
00112 );
00113 /// Return an Errata populated with a printf style formatted string.
00114 /// Use message ID 0.
00115 /// @return @a err.
00116 Errata logf(
00117   Errata::Code code, ///< Severity level.
00118   char const* format, ///< Message text.
00119   ...
00120 );
00121 /** Return an Errata based on @c errno.
00122     The literal string is combined with the system text for the current
00123     value of @c errno. This is modeled on @c perror. Message ID 0 is used.
00124     @return The new @c Errata.
00125  */
00126 Errata log_errno(
00127   Errata::Code code, ///< Severity level.
00128   char const* text ///< Message text.
00129 );
00130 /** Return an @c Errata based on @c errno.
00131     @c errno and the corresponding system error string are appended to
00132     the results from the @a format and following arguments.
00133     @return The new @c Errata.
00134  */
00135 Errata
00136 logf_errno(
00137   Errata::Code code,  ///< Severity code.
00138   char const* format, ///< Format string.
00139   ... ///< Arguments for @a format.
00140 );
00141 /** Add a message to an @a errata based on @c errno.
00142     @c errno and the corresponding system error string are appended to
00143     the results from the @a format and following arguments.
00144     @return @a errata.
00145  */
00146 Errata
00147 logf_errno(
00148   Errata& errata, ///< Errata to use.
00149   Errata::Code code,  ///< Severity code.
00150   char const* format, ///< Format string.
00151   ... ///< Arguments for @a format.
00152 );
00153 /** Add a message to a return value based on @c errno.
00154     @c errno and the corresponding system error string are appended to
00155     the results from the @a format and following arguments.
00156     @return The errata in @a rv.
00157  */
00158 Errata
00159 logf_errno(
00160   RvBase& rv, ///< Return value.
00161   Errata::Code code,  ///< Severity code.
00162   char const* format, ///< Format string.
00163   ... ///< Arguments for @a format.
00164 );
00165 //@}
00166 
00167 }} // namespace ts::msg
00168 
00169 # endif // define TS_ERRATA_UTIL_HEADER

Generated by  doxygen 1.7.1