1 /** 2 * @file defaults.h 3 * 4 * @brief Default levels, options, and text styling. 5 * 6 * The values herein represent the defaults for output destinations if defaults 7 * are requested upon initialization. 8 * 9 * @version 2.2.5 10 * 11 * ----------------------------------------------------------------------------- 12 * 13 * SPDX-License-Identifier: MIT 14 * 15 * Copyright (c) 2018-2024 Ryan M. Lederman <lederman@gmail.com> 16 * 17 * Permission is hereby granted, free of charge, to any person obtaining a copy of 18 * this software and associated documentation files (the "Software"), to deal in 19 * the Software without restriction, including without limitation the rights to 20 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 21 * the Software, and to permit persons to whom the Software is furnished to do so, 22 * subject to the following conditions: 23 * 24 * The above copyright notice and this permission notice shall be included in all 25 * copies or substantial portions of the Software. 26 * 27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 29 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 30 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 31 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 * 34 * ----------------------------------------------------------------------------- 35 */ 36 37 #ifndef _SIR_DEFAULTS_H_INCLUDED 38 # define _SIR_DEFAULTS_H_INCLUDED 39 40 # include "sir/types.h" 41 42 /** 43 * @defgroup default Defaults 44 * 45 * Default ::sir_option bitmasks, ::sir_level registrations, and 46 * ::sir_textstyle bitmasks. 47 * 48 * @see ::SIRO_DEFAULT 49 * @see ::SIRL_DEFAULT 50 * 51 * @addtogroup default 52 * @{ 53 */ 54 55 /** 56 * Default levels for stdout. 57 * 58 * The stdout destination is registered for these levels if 59 * ::SIRL_DEFAULT is set on the ::sir_stdio_dest when 60 * ::sir_init is called. 61 * 62 * @note Can be modified at runtime by calling ::sir_stdoutlevels. 63 */ 64 static const sir_levels sir_stdout_def_lvls 65 = SIRL_DEBUG | SIRL_INFO | SIRL_NOTICE | SIRL_WARN; 66 67 /** 68 * Default options for stdout. 69 * 70 * These options are applied to the stdout destination if 71 * ::SIRO_DEFAULT is set on the ::sir_stdio_dest when 72 * ::sir_init is called. 73 * 74 * @note Can be modified at runtime by calling ::sir_stdoutopts. 75 */ 76 static const sir_options sir_stdout_def_opts 77 = SIRO_NOTIME | SIRO_NOHOST | SIRO_NOPID | SIRO_NOTID; 78 79 /** 80 * Default levels for stderr. 81 * 82 * The stderr destination is registered for these levels if 83 * ::SIRL_DEFAULT is set on the ::sir_stdio_dest when 84 * ::sir_init is called. 85 * 86 * @note Can be modified at runtime by calling ::sir_stderrlevels. 87 */ 88 static const sir_levels sir_stderr_def_lvls 89 = SIRL_ERROR | SIRL_CRIT | SIRL_ALERT | SIRL_EMERG; 90 91 /** 92 * Default options for stderr. 93 * 94 * These options are applied to the stderr destination if 95 * ::SIRO_DEFAULT is set on the ::sir_stdio_dest when 96 * ::sir_init is called. 97 * 98 * @note Can be modified at runtime by calling ::sir_stderropts. 99 */ 100 static const sir_options sir_stderr_def_opts 101 = SIRO_NOTIME | SIRO_NOHOST | SIRO_NOPID | SIRO_NOTID; 102 103 /** 104 * Default levels for the system logger. 105 * 106 * The system logger destination is registered for these levels 107 * if ::SIRL_DEFAULT is set on the ::sir_syslog_dest when 108 * ::sir_init is called. 109 * 110 * @note Can be modified at runtime by calling ::sir_sysloglevels. 111 */ 112 static const sir_levels sir_syslog_def_lvls 113 = SIRL_NOTICE | SIRL_WARN | SIRL_ERROR | SIRL_CRIT | 114 SIRL_ALERT | SIRL_EMERG; 115 116 /** 117 * Default options for the system logger. 118 * 119 * Applied to the system logger destination if ::SIRO_DEFAULT 120 * is set on the ::sir_syslog_dest when ::sir_init is called. 121 * 122 * @note Can be modified at runtime by calling ::sir_syslogopts. 123 * 124 * @note ::SIRO_MSGONLY disables all output formatting, leaving 125 * just the message text itself. 126 */ 127 static const sir_options sir_syslog_def_opts 128 = SIRO_MSGONLY; 129 130 /** 131 * Default levels for log files. 132 * 133 * Log file destinations are registered for these levels if 134 * ::SIRL_DEFAULT is passed to ::sir_addfile. 135 * 136 * @note Can be modified at runtime by calling ::sir_filelevels. 137 * 138 * @note ::SIRL_ALL includes every logging level from debug to emergency. 139 */ 140 static const sir_levels sir_file_def_lvls 141 = SIRL_ALL; 142 143 /** 144 * Default options for log files. 145 * 146 * Applied to log file destinations if ::SIRO_DEFAULT is 147 * passed to ::sir_addfile. 148 * 149 * @note Can be modified at runtime by calling ::sir_fileopts. 150 */ 151 static const sir_options sir_file_def_opts 152 = SIRO_ALL | SIRO_NOHOST; 153 154 /** 155 * Default ::sir_textstyle for ::SIRL_EMERG. 156 * 157 * Applied to stdio destinations upon library initialization. 158 * 159 * @note Can be modified at runtime by calling ::sir_settextstyle. 160 */ 161 static const sir_textstyle sir_lvl_emerg_def_style = { 162 SIRTA_BOLD, 163 SIRTC_BYELLOW, 164 SIRTC_RED 165 }; 166 167 /** 168 * Default ::sir_textstyle for ::SIRL_ALERT. 169 * 170 * Applied to stdio destinations upon library initialization. 171 * 172 * @note Can be modified at runtime by calling ::sir_settextstyle. 173 */ 174 static const sir_textstyle sir_lvl_alert_def_style = { 175 SIRTA_BOLD, 176 SIRTC_BLACK, 177 SIRTC_BYELLOW 178 }; 179 180 /** 181 * Default ::sir_textstyle for ::SIRL_CRIT. 182 * 183 * Applied to stdio destinations upon library initialization. 184 * 185 * @note Can be modified at runtime by calling ::sir_settextstyle. 186 */ 187 static const sir_textstyle sir_lvl_crit_def_style = { 188 SIRTA_BOLD, 189 SIRTC_RED, 190 SIRTC_DEFAULT 191 }; 192 193 /** 194 * Default ::sir_textstyle for ::SIRL_ERROR. 195 * 196 * Applied to stdio destinations upon library initialization. 197 * 198 * @note Can be modified at runtime by calling ::sir_settextstyle. 199 */ 200 static const sir_textstyle sir_lvl_error_def_style = { 201 SIRTA_NORMAL, 202 SIRTC_RED, 203 SIRTC_DEFAULT 204 }; 205 206 /** 207 * Default ::sir_textstyle for ::SIRL_WARN. 208 * 209 * Applied to stdio destinations upon library initialization. 210 * 211 * @note Can be modified at runtime by calling ::sir_settextstyle. 212 */ 213 static const sir_textstyle sir_lvl_warn_def_style = { 214 SIRTA_BOLD, 215 SIRTC_YELLOW, 216 SIRTC_DEFAULT 217 }; 218 219 /** 220 * Default ::sir_textstyle for ::SIRL_NOTICE. 221 * 222 * Applied to stdio destinations upon library initialization. 223 * 224 * @note Can be modified at runtime by calling ::sir_settextstyle. 225 */ 226 static const sir_textstyle sir_lvl_notice_def_style = { 227 SIRTA_NORMAL, 228 SIRTC_CYAN, 229 SIRTC_DEFAULT 230 }; 231 232 /** 233 * Default ::sir_textstyle for ::SIRL_INFO. 234 * 235 * Applied to stdio destinations upon library initialization. 236 * 237 * @note Can be modified at runtime by calling ::sir_settextstyle. 238 */ 239 static const sir_textstyle sir_lvl_info_def_style = { 240 SIRTA_NORMAL, 241 SIRTC_WHITE, 242 SIRTC_DEFAULT 243 }; 244 245 /** 246 * Default ::sir_textstyle for ::SIRL_DEBUG. 247 * 248 * Applied to stdio destinations upon library initialization. 249 * 250 * @note Can be modified at runtime by calling ::sir_settextstyle. 251 */ 252 static const sir_textstyle sir_lvl_debug_def_style = { 253 SIRTA_NORMAL, 254 SIRTC_DGRAY, 255 SIRTC_DEFAULT 256 }; 257 258 /** @} */ 259 260 #endif /* !_SIR_DEFAULTS_H_INCLUDED */