libsir 2.2.5
Standard Incident Reporter
|
Compile-time configuration. More...
Go to the source code of this file.
Macros | |
#define | SIR_TIMEFORMAT "%H:%M:%S" |
The time stamp format string at the start of log messages-not including milliseconds (as::SIR_MSECFORMAT), which is added separately. | |
#define | SIR_MSECFORMAT ".%03ld" |
The format for milliseconds (1000ths of a second) in time stamps. | |
#define | SIR_EOL_CR "\r" |
The carriage return (CR) character to use in the end of line sequence when SIR_USE_EOL_CRLF is defined. | |
#define | SIR_EOL_LF "\n" |
The line feed (LF) character to use in the end of line sequence. | |
#define | SIR_EOL SIR_EOL_LF |
The end of line sequence. | |
#define | SIR_LEVELPREFIX "[" |
The string placed directly before the human-readable logging level. | |
#define | SIR_LEVELSUFFIX "]" |
The string placed directly after the human-readable logging level. | |
#define | SIR_PIDPREFIX "(" |
The string placed directly before process and thread IDs. | |
#define | SIR_PIDSUFFIX ")" |
The character placed directly after process and thread IDs. | |
#define | SIR_PIDFORMAT "%d" |
The format for the current process ID. | |
#define | SIR_TIDFORMAT "%d" |
The format for the current thread ID. | |
#define | SIR_PIDSEPARATOR "." |
The string to place between process and thread IDs. | |
#define | SIR_FOPENMODE "a" |
The string passed to fopen/fopen_s for log files. | |
#define | SIR_FROLLSIZE (1024 * 1024 * 5) |
The size, in bytes, at which a log file will be rolled/archived. | |
#define | SIR_FHTIMEFORMAT "%H:%M:%S %a %d %b %Y (%z)" |
The time format string used in file headers (see SIR_FHFORMAT). | |
#define | SIR_FHFORMAT SIR_EOL SIR_EOL "----- %s %s -----" SIR_EOL SIR_EOL |
The format string written to a log file when logging begins or the file is rolled/archived. | |
#define | SIR_FHBEGIN "session begin @" |
The string included in SIR_FHFORMAT when a logging session begins. | |
#define | SIR_FHROLLED "archived as %s due to size @" |
The string included in SIR_FHFORMAT when a file is rolled/archived due to becoming larger than SIR_FROLLSIZE bytes in size. | |
#define | SIR_FNAMETIMEFORMAT "%Y-%m-%d-%H%M%S" |
The time format string for rolled/archived log files (see SIR_FNAMEFORMAT). | |
#define | SIR_FNAMESEQFORMAT "-%hu" |
The sequence number format string for rolled/archived log files (see SIR_FNAMEFORMAT). | |
#define | SIR_FNAMEFORMAT "%s-%s%s%s" |
The format string for rolled/archived log file names. | |
#define | SIRL_S_EMERG "emrg" |
The human-readable form of the SIRL_EMERG level. | |
#define | SIRL_S_ALERT "alrt" |
The human-readable form of the SIRL_ALERT level. | |
#define | SIRL_S_CRIT "crit" |
The human-readable form of the SIRL_CRIT level. | |
#define | SIRL_S_ERROR "erro" |
The human-readable form of the SIRL_ERROR level. | |
#define | SIRL_S_WARN "warn" |
The human-readable form of the SIRL_WARN level. | |
#define | SIRL_S_NOTICE "noti" |
The human-readable form of the SIRL_NOTICE level. | |
#define | SIRL_S_INFO "info" |
The human-readable form of the SIRL_INFO level. | |
#define | SIRL_S_DEBUG "debg" |
The human-readable form of the SIRL_DEBUG level. | |
#define | SIR_MAXFILES 16 |
The maximum number of log files that may be registered at one time. | |
#define | SIR_MAXPLUGINS 16 |
The maximum number of plugin modules that may be loaded at one time. | |
#define | SIR_MAXFHEADER 128 |
The size, in characters, of the buffer used to hold file header format strings. | |
#define | SIR_MAXMESSAGE 4096 |
The maximum number of characters allowable in one log message. | |
#define | SIR_MAXTIME 64 |
The size, in characters, of the buffer used to hold time format strings. | |
#define | SIR_MAXMSEC 5 |
The size, in characters, of the buffer used to hold millisecond strings. | |
#define | SIR_MAXLEVEL 7 |
The size, in characters, of the buffer used to hold level format strings. | |
#define | SIR_MAXNAME 32 |
The size, in characters, of the buffer used to hold process/appname format strings. | |
#define | SIR_MAX_SYSLOG_ID 128 |
The size, in characters, of the buffer used to hold system logger identity strings. | |
#define | SIR_MAX_SYSLOG_CAT 64 |
The size, in characters, of the buffer used to hold system logger category strings. | |
#define | SIR_MAXMISC 7 |
The maximum number of whitespace and miscellaneous characters included in output. | |
#define | SIR_MAXSTYLE 43 |
The size, in characters, of the buffer used to hold a sequence of styling data in any color mode (the largest possible sequence, which is: \x1b[a;fb;m;rrr;ggg;bbb;fb;m;rrr;ggg;bbbm ) plus a null terminator. | |
#define | SIR_MAXOUTPUT |
The maximum size, in characters, of final formatted output. | |
#define | SIR_MAXERROR 256 |
The maximum size, in characters, of an error message. | |
#define | SIR_ERRORFORMAT "Error in %s (%s:%u): '%s'" |
The format string for error messages returned by sir_geterror. | |
#define | SIR_UNKNOWN "<unknown>" |
The string that represents any unknown. | |
#define | SIR_DESTNAME_STDERR "stderr" |
stderr destination string. | |
#define | SIR_DESTNAME_STDOUT "stdout" |
stdout destination string. | |
#define | SIR_DESTNAME_SYSLOG "syslog" |
System logger destination string. | |
#define | SIR_FALLBACK_SYSLOG_ID "libsir" |
Fallback system logger identity. | |
#define | SIR_FALLBACK_SYSLOG_CAT "general" |
Fallback system logger category. | |
#define | SIR_NUMLEVELS 8 |
The number of actual levels; SIRL_NONE, SIRL_ALL, and SIRL_DEFAULT are pseudo levels and end up being mapped (or not) to the others. | |
#define | SIR_NUMOPTIONS 8 |
The number of actual options; SIRO_ALL, SIRO_DEFAULT, and SIRO_MSGONLY are pseudo options that end up being mapped (or not) to the others. | |
#define | SIR_HNAME_CHK_INTERVAL 60 |
The number of seconds to let elapse before checking if the hostname needs refreshing. | |
#define | SIR_THRD_CHK_INTERVAL 333.0 |
The number of milliseconds to let elapse before re-formatting the current thread identifier and/or name. | |
#define | SIR_FILE_CHK_SIZE_WRITES 10 |
The number of writes to a file to let occur before checking its current size to determine if it needs to be rolled. | |
#define | SIR_SQUELCH_THRESHOLD 5 |
The number of consecutive duplicate messages that will cause libsir to squelch further identical messages, and instead log the message SIR_SQUELCH_MSG_FORMAT. | |
#define | SIR_SQUELCH_BACKOFF_FACTOR 2 |
If duplicate messages continue to be logged after the threshold is met, the threshold will be multiplied by this number, resulting in longer intervals between SIR_SQUELCH_MSG_FORMAT messages. | |
#define | SIR_SQUELCH_MSG_FORMAT "previous message repeated %zu times" |
The message to be logged when SIR_SQUELCH_THRESHOLD (or a multiple thereof) consecutive duplicate messages are logged. | |
Compile-time configuration.
The definitions herein may be modified for fine-grained control over the appearance and content of log messages, default values, and various thresholds (e.g. file and buffer sizes).
SPDX-License-Identifier: MIT
Copyright (c) 2018-2024 Ryan M. Lederman leder.nosp@m.man@.nosp@m.gmail.nosp@m..com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SIR_EOL SIR_EOL_LF |
The end of line sequence.
If SIR_USE_EOL_CRLF is defined, the sequence will be SIR_EOL_CR + SIR_EOL_LF; otherwise just SIR_EOL_LF.
#define SIR_ERRORFORMAT "Error in %s (%s:%u): '%s'" |
The format string for error messages returned by sir_geterror.
%s
format specifier is the function name.%s
is the file name.%lu
is the line number in the file.%s
is the error message.Example
#define SIR_FHBEGIN "session begin @" |
The string included in SIR_FHFORMAT when a logging session begins.
The format string written to a log file when logging begins or the file is rolled/archived.
%s
format specifier is the message:
%s
is the current date/time in the format specified by SIR_FHTIMEFORMAT. #define SIR_FHROLLED "archived as %s due to size @" |
The string included in SIR_FHFORMAT when a file is rolled/archived due to becoming larger than SIR_FROLLSIZE bytes in size.
The %s
format specifier is the path of the archived file.
#define SIR_FHTIMEFORMAT "%H:%M:%S %a %d %b %Y (%z)" |
The time format string used in file headers (see SIR_FHFORMAT).
Example
#define SIR_FNAMEFORMAT "%s-%s%s%s" |
The format string for rolled/archived log file names.
Example
#define SIR_FNAMESEQFORMAT "-%hu" |
#define SIR_FNAMETIMEFORMAT "%Y-%m-%d-%H%M%S" |
The time format string for rolled/archived log files (see SIR_FNAMEFORMAT).
Example
#define SIR_FROLLSIZE (1024 * 1024 * 5) |
The size, in bytes, at which a log file will be rolled/archived.
#define SIR_HNAME_CHK_INTERVAL 60 |
The number of seconds to let elapse before checking if the hostname needs refreshing.
The default is an eager 1 minute. Better safe than wrong?
#define SIR_LEVELPREFIX "[" |
The string placed directly before the human-readable logging level.
#define SIR_LEVELSUFFIX "]" |
The string placed directly after the human-readable logging level.
#define SIR_MAXMESSAGE 4096 |
The maximum number of characters allowable in one log message.
This does not include accompanying formatted output (see SIR_MAXOUTPUT).
#define SIR_MSECFORMAT ".%03ld" |
The format for milliseconds (1000ths of a second) in time stamps.
Example
#define SIR_PIDFORMAT "%d" |
The format for the current process ID.
#define SIR_PIDPREFIX "(" |
The string placed directly before process and thread IDs.
#define SIR_PIDSEPARATOR "." |
The string to place between process and thread IDs.
Example
#define SIR_PIDSUFFIX ")" |
The character placed directly after process and thread IDs.
#define SIR_TIDFORMAT "%d" |
The format for the current thread ID.
#define SIR_TIMEFORMAT "%H:%M:%S" |
The time stamp format string at the start of log messages-not including milliseconds (as::SIR_MSECFORMAT), which is added separately.
Example