stumpless 2.2.0
|
File targets allow logs to be sent to a specified file. More...
Go to the source code of this file.
Functions | |
STUMPLESS_PUBLIC_FUNCTION void | stumpless_close_file_target (struct stumpless_target *target) |
Closes a file target. | |
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * | stumpless_open_file_target (const char *name) |
Opens a file target. | |
File targets allow logs to be sent to a specified file.
Files are created as needed, and logs are appended to any existing contents.
Thread Safety: MT-Safe Logging to file targets is thread safe. A mutex is used to coordinate writes to the file.
Async Signal Safety: AS-Unsafe lock Logging to file targets is not signal safe, as a non-reentrant lock is used to coordinate writes to the file.
Async Cancel Safety: AC-Unsafe lock Logging to file targets is not safe to call from threads that may be asynchronously cancelled, as the cleanup of the lock may not be completed.
STUMPLESS_PUBLIC_FUNCTION void stumpless_close_file_target | ( | struct stumpless_target * | target | ) |
Closes a file target.
This function closes the file target, as well as the stream opened to the file.
Thread Safety: MT-Unsafe This function is not thread safe as it destroys resources that other threads would use if they tried to reference this target.
Async Signal Safety: AS-Unsafe lock heap This function is not safe to call from signal handlers due to the destruction of a lock that may be in use as well as the use of the memory deallocation function to release memory.
Async Cancel Safety: AC-Unsafe lock heap This function is not safe to call from threads that may be asynchronously cancelled, as the cleanup of the lock may not be completed, and the memory deallocation function may not be AC-Safe itself.
target | The file target to close. |
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_file_target | ( | const char * | name | ) |
Opens a file target.
File targets send logs to a file on the system. Note that this will open the specified file, and it will remain open while the file target is open. If you need to control the file stream yourself, then you should consider using a stream target instead.
Thread Safety: MT-Safe race:name This function is thread safe, of course assuming that name is not modified by any other threads during execution.
Async Signal Safety: AS-Unsafe heap This function is not safe to call from signal handlers due to the use of memory allocation functions.
Async Cancel Safety: AC-Unsafe heap This function is not safe to call from threads that may be asynchronously cancelled, as the memory allocation function may not be AC-Safe itself.
name | The name of the logging target, as well as the name of the file to open. |