stumpless 2.2.0
|
Convenience functions for creating and writing simple log entries. 更多...
函数 | |
int | stump (const char *message,...) |
Logs a message to the default target. | |
int | stump_str (const char *message) |
Logs a message to the default target. | |
int | stump_trace (const char *file, int line, const char *func, const char *message,...) |
Logs a message to the default target, along with the file, line, and function information specified in a structured data element. | |
int | stump_trace_str (const char *file, int line, const char *func, const char *message) |
Logs a message to the default target, along with the file, line, and function information specified in a structured data element. | |
void | stumplog (int priority, const char *message,...) |
Logs a message to the current target with the given priority. | |
int | stumplog_set_mask (int mask) |
Sets the log mask of the current target. | |
void | stumplog_str (int priority, const char *message) |
Logs a message to the current target with the given priority. | |
void | stumplog_trace (int priority, const char *file, int line, const char *func, const char *message,...) |
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element. | |
void | stumplog_trace_str (int priority, const char *file, int line, const char *func, const char *message) |
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element. | |
int | vstump (const char *message, va_list subs) |
Logs a message to the default target. | |
int | vstump_trace (const char *file, int line, const char *func, const char *message, va_list subs) |
Logs a message to the default target, along with the file, line, and function information specified in a structured data element. | |
void | vstumplog (int priority, const char *message, va_list subs) |
Logs a message to the default target with the given priority. | |
void | vstumplog_trace (int priority, const char *file, int line, const char *func, const char *message, va_list subs) |
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element. | |
Convenience functions for creating and writing simple log entries.
int stump | ( | const char * | message, |
... ) |
Logs a message to the default target.
The message must be a valid format specifier string provided along with the appropriate number of variable arguments afterwards. This means that it should not be a user-controlled value under any circumstances. If you need a safer alternative without the risks of format strings, use stump_str() instead.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
message | The message to log, optionally containing any format specifiers valid in printf . This must be a valid UTF-8 string in shortest form. |
... | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. |
int stump_str | ( | const char * | message | ) |
Logs a message to the default target.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
message | The message to log. This must be a valid UTF-8 string in shortest form. |
int stump_trace | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
const char * | message, | ||
... ) |
Logs a message to the default target, along with the file, line, and function information specified in a structured data element.
The trace information is added in an element named trace
with params named file
, line
, and function
for the respective pieces of information.
The message must be a valid format specifier string provided along with the appropriate number of variable arguments afterwards. This means that it should not be a user-controlled value under any circumstances. If you need a safer alternative without the risks of format strings, use stump_trace_str
instead.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
file | The name of the source file the message should be tied to. |
line | The line in the source file that the message should be tied to. |
func | The name of the function that the message should be tied to. |
message | The message to log, optionally containing any format specifiers valid in printf . This must be a valid UTF-8 string in shortest form. |
... | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. |
int stump_trace_str | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
const char * | message ) |
Logs a message to the default target, along with the file, line, and function information specified in a structured data element.
The trace information is added in an element named trace
with params named file
, line
, and function
for the respective pieces of information.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
file | The name of the source file the message should be tied to. |
line | The line in the source file that the message should be tied to. |
func | The name of the function that the message should be tied to. |
message | The message to log. This must be a valid UTF-8 string in shortest form. |
void stumplog | ( | int | priority, |
const char * | message, | ||
... ) |
Logs a message to the current target with the given priority.
This function can serve as a replacement for the traditional syslog
function.
For detailed information on what the current target will be for a given system, check the stumpless_get_current_target() function documentation.
The message must be a valid format specifier string provided along with the appropriate number of variable arguments afterwards. This means that it should not be a user-controlled value under any circumstances. If you need a safer alternative without the risks of format strings, use stumplog_str
instead.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
priority | The priority of the message - this should be the bitwise or of a single STUMPLESS_SEVERITY and single STUMPLESS_FACILITY value. |
message | The message to log, optionally containing any format specifiers valid in printf . This must be a valid UTF-8 string in shortest form. |
... | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. |
int stumplog_set_mask | ( | int | mask | ) |
Sets the log mask of the current target.
The mask is a bit field of severities that this target will allow if the default mask-based filter is in use. These can be formed and checked using the STUMPLESS_SEVERITY_MASK and STUMPLESS_SEVERITY_MASK_UPTO macros, and combining them using bitwise or operations.
This function can serve as a replacement for the traditional setlogmask
function.
For detailed information on what the current target will be for a given system, check the stumpless_get_current_target() function documentation.
Thread Safety: MT-Safe This function is thread safe. A mutex is used to coordinate changes to the target while it is being modified.
Async Signal Safety: AS-Unsafe lock This function is not safe to call from signal handlers due to the use of a non-reentrant lock to coordinate changes.
Async Cancel Safety: AC-Unsafe lock This function is not safe to call from threads that may be asynchronously cancelled, due to the use of a lock that could be left locked.
mask | The mask to use with the target. |
void stumplog_str | ( | int | priority, |
const char * | message ) |
Logs a message to the current target with the given priority.
This function can serve as a replacement for the traditional syslog
function.
For detailed information on what the current target will be for a given system, check the stumpless_get_current_target() function documentation.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
priority | The priority of the message - this should be the bitwise or of a single STUMPLESS_SEVERITY and single STUMPLESS_FACILITY value. |
message | The message to log. This must be a valid UTF-8 string in shortest form. |
void stumplog_trace | ( | int | priority, |
const char * | file, | ||
int | line, | ||
const char * | func, | ||
const char * | message, | ||
... ) |
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element.
The trace information is added in an element named trace
with params named file
, line
, and function
for the respective pieces of information.
This function can serve as a replacement for the traditional syslog
function.
For detailed information on what the default target will be for a given system, check the stumpless_get_default_target() function documentation.
The message must be a valid format specifier string provided along with the appropriate number of variable arguments afterwards. This means that it should not be a user-controlled value under any circumstances. If you need a safer alternative without the risks of format strings, use stumplog_trace_str() instead.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
priority | The priority of the message - this should be the bitwise or of a single STUMPLESS_SEVERITY and single STUMPLESS_FACILITY value. |
file | The name of the source file the entry should be tied to. |
line | The line in the source file that the entry should be tied to. |
func | The name of the function that the entry should be tied to. |
message | The message to log, optionally containing any format specifiers valid in printf . This must be a valid UTF-8 string in shortest form. |
... | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. |
void stumplog_trace_str | ( | int | priority, |
const char * | file, | ||
int | line, | ||
const char * | func, | ||
const char * | message ) |
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element.
The trace information is added in an element named trace
with params named file
, line
, and function
for the respective pieces of information.
This function can serve as a replacement for the traditional syslog
function.
For detailed information on what the default target will be for a given system, check the stumpless_get_default_target() function documentation.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
priority | The priority of the message - this should be the bitwise or of a single STUMPLESS_SEVERITY and single STUMPLESS_FACILITY value. |
file | The name of the source file the entry should be tied to. |
line | The line in the source file that the entry should be tied to. |
func | The name of the function that the entry should be tied to. |
message | The message to log. This must be a valid UTF-8 string in shortest form. |
int vstump | ( | const char * | message, |
va_list | subs ) |
Logs a message to the default target.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
message | The message to log, optionally containing any format specifiers valid in printf . |
subs | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. This list must be started via va_start before being used, and va_end should be called afterwards, as this function does not call it. |
int vstump_trace | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
const char * | message, | ||
va_list | subs ) |
Logs a message to the default target, along with the file, line, and function information specified in a structured data element.
The trace information is added in an element named trace
with params named file
, line
, and function
for the respective pieces of information.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
file | The name of the source file the message should be tied to. |
line | The line in the source file that the message should be tied to. |
func | The name of the function that the message should be tied to. |
message | The message to log, optionally containing any format specifiers valid in printf . |
subs | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. This list must be started via va_start before being used, and va_end should be called afterwards, as this function does not call it. |
void vstumplog | ( | int | priority, |
const char * | message, | ||
va_list | subs ) |
Logs a message to the default target with the given priority.
Can serve as a replacement for the traditional vsyslog
function.
For detailed information on what the default target will be for a given system, check the stumpless_get_default_target() function documentation.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
priority | The priority of the message - this should be the bitwise or of a single STUMPLESS_SEVERITY and single STUMPLESS_FACILITY value. |
message | The message to log, optionally containing any format specifiers valid in printf . |
subs | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. This list must be started via va_start before being used, and va_end should be called afterwards, as this function does not call it. |
void vstumplog_trace | ( | int | priority, |
const char * | file, | ||
int | line, | ||
const char * | func, | ||
const char * | message, | ||
va_list | subs ) |
Logs a message to the default target with the given priority, along with the file, line, and function information specified in a structured data element.
The trace information is added in an element named trace
with params named file
, line
, and function
for the respective pieces of information.
This function can serve as a replacement for the traditional vsyslog
function.
For detailed information on what the default target will be for a given system, check the stumpless_get_default_target() function documentation.
Thread Safety: MT-Safe env locale This function is thread safe. Different target types handle thread safety differently, as some require per-target locks and others can rely on system libraries to log safely, but all targets support thread safe logging in some manner. For target-specific information on how thread safety is supported and whether AS or AC safety can be assumed, refer to the documentation for the target's header file (in the stumpless/target
include folder). For all targets, the environment variables and locale will be used during some of the string formatting of the message.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers as some targets make use of non-reentrant locks to coordinate access. It also may make memory allocation calls to create internal cached structures, and memory allocation may not be signal safe.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, due to the use of locks in some targets that could be left locked and the potential for memory allocation.
priority | The priority of the message - this should be the bitwise or of a single STUMPLESS_SEVERITY and single STUMPLESS_FACILITY value. |
file | The name of the source file the message should be tied to. |
line | The line in the source file that the message should be tied to. |
func | The name of the function that the message should be tied to. |
message | The message to log, optionally containing any format specifiers valid in printf . |
subs | Substitutions for any format specifiers provided in message. The number of substitutions provided must exactly match the number of specifiers given. This list must be started via va_start before being used, and va_end should be called afterwards, as this function does not call it. |