rlg::utils

Function sanitize_log_message

Source
pub fn sanitize_log_message(message: &str) -> String
Expand description

Sanitizes a string for use in log messages.

This function replaces newlines and control characters with spaces.

§Arguments

  • message - A string slice that holds the message to be sanitized.

§Returns

A String with sanitized content.

§Examples

use rlg::utils::sanitize_log_message;

let message = "Hello\nWorld\r\u{0007}";
let sanitized = sanitize_log_message(message);
assert_eq!(sanitized, "Hello World  ");