33#ifndef _SIR_TYPES_H_INCLUDED
34# define _SIR_TYPES_H_INCLUDED
36# include "sir/platform.h"
58# define SIRL_NONE 0x0000U
59# define SIRL_EMERG 0x0001U
60# define SIRL_ALERT 0x0002U
61# define SIRL_CRIT 0x0004U
62# define SIRL_ERROR 0x0008U
63# define SIRL_WARN 0x0010U
64# define SIRL_NOTICE 0x0020U
65# define SIRL_INFO 0x0040U
66# define SIRL_DEBUG 0x0080U
67# define SIRL_ALL 0x00ffU
68# define SIRL_DEFAULT 0x0100U
80# define SIRO_ALL 0x00000000U
81# define SIRO_NOTIME 0x00000100U
82# define SIRO_NOMSEC 0x00000200U
83# define SIRO_NOHOST 0x00000400U
84# define SIRO_NOLEVEL 0x00000800U
85# define SIRO_NONAME 0x00001000U
86# define SIRO_NOPID 0x00002000U
87# define SIRO_NOTID 0x00004000U
88# define SIRO_NOHDR 0x00010000U
89# define SIRO_MSGONLY 0x00007f00U
90# define SIRO_DEFAULT 0x00100000U
262# define _SIR_MAGIC 0x60906090U
265# define SIRSL_IS_OPEN 0x00000001U
266# define SIRSL_LEVELS 0x00000002U
267# define SIRSL_OPTIONS 0x00000004U
268# define SIRSL_CATEGORY 0x00000008U
269# define SIRSL_IDENTITY 0x00000010U
270# define SIRSL_UPDATED 0x00000020U
271# define SIRSL_IS_INIT 0x00000040U
276typedef void (*invalparamfn)(
const wchar_t*,
const wchar_t*,
const wchar_t*,
277 unsigned int, uintptr_t);
282# if !defined(__WIN__)
286 LARGE_INTEGER counter;
294 char hostname[SIR_MAXHOST];
295 time_t last_hname_chk;
296 char pidbuf[SIR_MAXPID];
319 int writes_since_size_chk;
342# define SIR_PLUGIN_V1 1
343# define SIR_PLUGIN_VCURRENT SIR_PLUGIN_V1
346# define SIR_PLUGIN_EXPORT_QUERY "sir_plugin_query"
347# define SIR_PLUGIN_EXPORT_INIT "sir_plugin_init"
348# define SIR_PLUGIN_EXPORT_WRITE "sir_plugin_write"
349# define SIR_PLUGIN_EXPORT_CLEANUP "sir_plugin_cleanup"
353typedef bool (*sir_plugin_initfn)(void);
354typedef bool (*sir_plugin_writefn)(
sir_level,
const char*);
355typedef bool (*sir_plugin_cleanupfn)(void);
370 sir_pluginhandle handle;
385typedef struct _sir_queue_node {
386 struct _sir_queue_node* next;
416 const char* hostname;
420 char tid[SIR_MAXPID];
450# if !defined(SIR_NO_TEXT_STYLING)
469typedef uint32_t sir_config_data_field;
471# define SIRU_LEVELS 0x00000001U
472# define SIRU_OPTIONS 0x00000002U
473# define SIRU_SYSLOG_ID 0x00000004U
474# define SIRU_SYSLOG_CAT 0x00000008U
475# define SIRU_ALL 0x0000000fU
ANSI escape sequence macros.
Compile-time configuration.
#define SIR_MAX_SYSLOG_ID
The size, in characters, of the buffer used to hold system logger identity strings.
Definition config.h:373
#define SIR_MAXSTYLE
The size, in characters, of the buffer used to hold a sequence of styling data in any color mode (the...
Definition config.h:397
#define SIR_MAXMESSAGE
The maximum number of characters allowable in one log message.
Definition config.h:342
#define SIR_MAXNAME
The size, in characters, of the buffer used to hold process/appname format strings.
Definition config.h:365
#define SIR_MAXPLUGINS
The maximum number of plugin modules that may be loaded at one time.
Definition config.h:329
#define SIR_MAXFILES
The maximum number of log files that may be registered at one time.
Definition config.h:324
#define SIR_MAXMSEC
The size, in characters, of the buffer used to hold millisecond strings.
Definition config.h:352
#define SIR_MAXOUTPUT
The maximum size, in characters, of final formatted output.
Definition config.h:413
#define SIR_MAXTIME
The size, in characters, of the buffer used to hold time format strings.
Definition config.h:347
#define SIR_MAX_SYSLOG_CAT
The size, in characters, of the buffer used to hold system logger category strings.
Definition config.h:381
#define SIR_MAXERROR
The maximum size, in characters, of an error message.
Definition config.h:419
const char * file
Name of the file in which the error occurred.
Definition types.h:152
uint16_t code
Numeric error code (see sir_errorcode).
Definition types.h:156
int os_code
If an OS/libc error, the relevant code.
Definition types.h:154
sir_levels levels
sir_level bitmask defining levels to register for.
Definition types.h:196
sir_levels levels
sir_level bitmask defining output levels to register for.
Definition types.h:183
sir_textcolor bg
Background color.
Definition types.h:172
sir_textattr attr
Text attributes.
Definition types.h:170
sir_options opts
sir_option bitmask defining the formatting of output.
Definition types.h:186
sir_syslog_dest d_syslog
System logger configuration.
Definition types.h:247
uint32_t line
Line number at which the error occurred.
Definition types.h:153
sir_stdio_dest d_stdout
stdout configuration.
Definition types.h:245
sir_stdio_dest d_stderr
stderr configuration.
Definition types.h:246
sir_textcolor fg
Foreground color.
Definition types.h:171
sir_options opts
sir_option bitmask defining the formatting of output.
Definition types.h:212
const char * func
Name of the function in which the error occurred.
Definition types.h:151
uint16_t sir_level
The sir_level type.
Definition types.h:71
uint32_t sirfileid
Log file identifier type.
Definition types.h:49
sir_textattr
Attributes for stdio output.
Definition types.h:107
sir_colormode
Color mode selection.
Definition types.h:99
uint16_t sir_levels
sir_level bitmask type.
Definition types.h:74
uint32_t sir_textcolor
stdio text color type.
Definition types.h:141
uint32_t sir_option
The sir_option type.
Definition types.h:93
uint32_t sirpluginid
Plugin module identifier type.
Definition types.h:52
uint32_t sir_options
sir_option bitmask type.
Definition types.h:96
@ SIRTA_EMPH
Italicized/emphasized text.
Definition types.h:111
@ SIRTA_DIM
Dimmed text.
Definition types.h:110
@ SIRTA_ULINE
Underlined text.
Definition types.h:112
@ SIRTA_NORMAL
Normal text.
Definition types.h:108
@ SIRTA_BOLD
Bold text.
Definition types.h:109
@ SIRCM_16
4-bit 16-color mode.
Definition types.h:100
@ SIRCM_RGB
24-bit RGB-color mode.
Definition types.h:102
@ SIRCM_INVALID
Represents the invalid color mode.
Definition types.h:103
@ SIRCM_256
8-bit 256-color mode.
Definition types.h:101
@ SIRTC_LGRAY
Light gray.
Definition types.h:125
@ SIRTC_BYELLOW
Bright yellow.
Definition types.h:129
@ SIRTC_CYAN
Cyan.
Definition types.h:124
@ SIRTC_YELLOW
Yellow.
Definition types.h:121
@ SIRTC_BLUE
Blue.
Definition types.h:122
@ SIRTC_BGREEN
Bright green.
Definition types.h:128
@ SIRTC_DEFAULT
Represents the default color.
Definition types.h:137
@ SIRTC_BLACK
Black.
Definition types.h:118
@ SIRTC_WHITE
White.
Definition types.h:133
@ SIRTC_BMAGENTA
Bright magenta.
Definition types.h:131
@ SIRTC_BCYAN
Bright cyan.
Definition types.h:132
@ SIRTC_MAGENTA
Magenta.
Definition types.h:123
@ SIRTC_RED
Red.
Definition types.h:119
@ SIRTC_BBLUE
Bright blue.
Definition types.h:130
@ SIRTC_BRED
Bright red.
Definition types.h:127
@ SIRTC_GREEN
Green.
Definition types.h:120
@ SIRTC_DGRAY
Dark gray.
Definition types.h:126
Information about an error that occurred.
Definition types.h:150
Configuration for stdio destinations (stdout and stderr).
Definition types.h:181
Configuration for the system logger destination.
Definition types.h:195
Container for all the information associated with the appearance of text in the context of stdio.
Definition types.h:169
libsir initialization and configuration data.
Definition types.h:244
sir_level <-> human-readable string form.
Definition types.h:440
const sir_level level
The level for which the string applies.
Definition types.h:441
const char * fmt
The formatted string representation.
Definition types.h:442
sir_level <-> sir_textstyle mapping.
Definition types.h:427
sir_textstyle style
The un-formatted representation.
Definition types.h:429
const sir_level level
The level for which the style applies.
Definition types.h:428
Internally-used plugin module data.
Definition types.h:368
Plugin module cache.
Definition types.h:379
Plugin interface for v1.
Definition types.h:358
sir_plugin_cleanupfn cleanup
Address of sir_plugin_cleanup.
Definition types.h:362
sir_plugin_queryfn query
Address of sir_plugin_query.
Definition types.h:359
sir_plugin_writefn write
Address of sir_plugin_write.
Definition types.h:361
sir_plugin_initfn init
Address of sir_plugin_init.
Definition types.h:360
The libsir-to-plugin query data structure.
Definition types.h:329
uint8_t iface_ver
Plugin interface version.
Definition types.h:330
uint8_t bld_ver
Build/patch version number.
Definition types.h:333
uint8_t min_ver
Minor version number.
Definition types.h:332
uint64_t caps
Plugin capabilities bitmask.
Definition types.h:338
const char * desc
Plugin description.
Definition types.h:337
const char * author
Plugin author information.
Definition types.h:336
sir_levels levels
Level registration bitmask.
Definition types.h:334
uint8_t maj_ver
Major version number.
Definition types.h:331
sir_options opts
Formatting options bitmask.
Definition types.h:335
A node in a sir_queue.
Definition types.h:385
FIFO queue.
Definition types.h:391
sir_queue_node * head
The first node in the linked list.
Definition types.h:392
Container for text style related data that is mutex protected.
Definition types.h:434
Per-thread error type.
Definition types.h:456
Job used by a job queue.
Definition types.h:396
void * data
Data to pass to the callback.
Definition types.h:398
Thread pool/job queue data container.
Definition types.h:402
size_t num_threads
The number of threads in the pool.
Definition types.h:404
sir_queue * jobs
A queue of jobs to run (FIFO).
Definition types.h:405
sir_condition cond
A condition which indicates that a job is ready.
Definition types.h:406
sir_thread * threads
A list of thread handles.
Definition types.h:403
sir_mutex mutex
A mutex to be paired with the condition variable.
Definition types.h:407
bool cancel
Causes threads in the pool to exit when true.
Definition types.h:408
Internally-used time value type.
Definition types.h:281
Encapsulates dynamic updating of current configuration.
Definition types.h:478
const char * sl_identity
System logger identity.
Definition types.h:482
sir_levels * levels
Level registrations.
Definition types.h:480
sir_options * opts
Formatting options.
Definition types.h:481
const char * sl_category
System logger category.
Definition types.h:483
uint32_t fields
sir_config_data_field bitmask.
Definition types.h:479
Formatted output container.
Definition types.h:412
Internally-used global config container.
Definition types.h:291
Log file cache.
Definition types.h:323
Internally-used log file data.
Definition types.h:313