Skip to main content

parse_access_log_directive

Function parse_access_log_directive 

Source
pub fn parse_access_log_directive(
    access_log: Option<&String>,
) -> (Option<String>, Option<String>)
Expand description

Parse the access log directive

§Arguments

  • access_log - The access log directive

§Returns

  • (access_log, path) - The access log directive and the path

§Examples

use pingap_logger::parse_access_log_directive;
let (access_log, path) = parse_access_log_directive(Some(
    &"{when} {host} {method} {path}".to_string(),
));
assert_eq!(Some("{when} {host} {method} {path}".to_string()), access_log);
assert_eq!(None, path);
use pingap_logger::parse_access_log_directive;
let (access_log, path) = parse_access_log_directive(Some(
    &"/var/log/pingap.log {when} {host} {method} {path}".to_string(),
));
assert_eq!(Some("{when} {host} {method} {path}".to_string()), access_log);
assert_eq!(Some("/var/log/pingap.log".to_string()), path);