Skip to main content

Module utils

Module utils 

Source
Expand description

Timestamps, file I/O helpers, and input sanitization.

Functionsยง

format_file_size
Formats a file size in a human-readable format.
generate_span_id
Generates a highly unique, 16-character pseudo-random hex string suitable for OTLP span IDs.
generate_timestamp
Generates a timestamp string in ISO 8601 format.
generate_trace_id
Generates a highly unique, 32-character pseudo-random hex string suitable for OTLP trace IDs.
is_directory_writable
Checks if a directory is writable.
is_file_writable
Checks if a file exists and is writable.
parse_datetime
Parses a datetime string in ISO 8601 format.
sanitize_log_message
Sanitizes a string for use in log messages.
truncate_file
Truncates the file at the given path to the specified size.