Write a snapshot of slog2 logs to a file
#include <sys/slog2.h> int slog2_dump_logs_to_file( FILE *file, uint32_t flags, ... );
The slog2_dump_logs_to_file() writes a snapshot of slog2 logs to a file, using the same log line format as slog2info.
0 on success, or -1 if an error occurred (errno is set).
Write only the logs from the current process:
FILE *file = fopen( "mylogs", "w" ); slog2_dump_logs_to_file( file, 0 ); fclose( file );
Implement the equivalent of slog2info > mylogs:
FILE *file = fopen( "mylogs", "w" ); slog2_dump_logs_to_file( file, SLOG2_DUMP_LOGS_ALL ); fclose( file );
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |