libsir 2.2.5
Standard Incident Reporter
Loading...
Searching...
No Matches
sir.c File Reference

Public interface to libsir. More...

Functions

bool sir_makeinit (sirinit *si)
 Fills out a sirinit structure with default values.
 
bool sir_init (sirinit *si)
 Initializes libsir for use.
 
bool sir_cleanup (void)
 Tears down and cleans up libsir after use.
 
bool sir_isinitialized (void)
 Determines whether or not libsir is in the initialized state.
 
uint16_t sir_geterror (char message[SIR_MAXERROR])
 Retrieves a formatted message for the last error that occurred on the calling thread and returns the associated error code.
 
void sir_geterrorinfo (sir_errorinfo *err)
 Retrieves granular information about the last error that occurred on the calling thread.
 
bool sir_debug (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_DEBUG level message.
 
bool sir_info (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_INFO level message.
 
bool sir_notice (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_NOTICE level message.
 
bool sir_warn (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_WARN level message.
 
bool sir_error (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_ERROR level message.
 
bool sir_crit (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_CRIT level message.
 
bool sir_alert (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_ALERT level message.
 
bool sir_emerg (PRINTF_FORMAT const char *format,...)
 Dispatches a SIRL_EMERG level message.
 
sirfileid sir_addfile (const char *path, sir_levels levels, sir_options opts)
 Adds a log file and registers it to receive log output.
 
bool sir_remfile (sirfileid id)
 Removes a file previously added to libsir.
 
sirpluginid sir_loadplugin (const char *path)
 Loads a plugin module from disk.
 
bool sir_unloadplugin (sirpluginid id)
 Unloads a previously registered plugin module.
 
bool sir_filelevels (sirfileid id, sir_levels levels)
 Set new level registrations for a log file already managed by libsir.
 
bool sir_fileopts (sirfileid id, sir_options opts)
 Set new formatting options for a log file already managed by libsir.
 
bool sir_settextstyle (sir_level level, sir_textattr attr, sir_textcolor fg, sir_textcolor bg)
 Set new text styling for stdio (stdout/stderr) destinations on a per-level basis.
 
bool sir_resettextstyles (void)
 Reset text styling for stdio (stdout/stderr) destinations to their default values.
 
sir_textcolor sir_makergb (sir_textcolor r, sir_textcolor g, sir_textcolor b)
 Creates a sir_textcolor from red, green, and blue components.
 
bool sir_setcolormode (sir_colormode mode)
 Sets the ANSI color mode for stdio destinations.
 
bool sir_stdoutlevels (sir_levels levels)
 Set new level registrations for stdout.
 
bool sir_stdoutopts (sir_options opts)
 Set new formatting options for stdout.
 
bool sir_stderrlevels (sir_levels levels)
 Set new level registrations for stderr.
 
bool sir_stderropts (sir_options opts)
 Set new formatting options for stderr.
 
bool sir_sysloglevels (sir_levels levels)
 Set new level registrations for the system logger destination.
 
bool sir_syslogopts (sir_options opts)
 Set new formatting options for the system logger destination.
 
bool sir_syslogid (const char *identity)
 Set new system logger identity.
 
bool sir_syslogcat (const char *category)
 Set new system logger category.
 
const char * sir_getversionstring (void)
 Returns the current libsir version as a string.
 
uint32_t sir_getversionhex (void)
 Returns the current libsir version as a number.
 
bool sir_isprerelease (void)
 Whether or not this is a pre-release version of libsir.
 

Detailed Description

Public interface to libsir.

The functions and types defined here comprise the entire set intended for use by an implementer of the library-unless modification is desired.

Version
2.2.5

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.