Skip to main content

log_initialization

Function log_initialization 

Source
pub fn log_initialization(log_file: &mut File, date: &str) -> Result<()>
Expand description

Records system initialisation in the logging system.

Creates a detailed log entry capturing the system’s startup state, including configuration and initial conditions. Uses the Common Log Format (CLF) for consistent logging.

§Arguments

  • log_file - Active file handle for writing log entries
  • date - Current date and time for log timestamps

§Returns

  • Ok(()) - If the log entry is written successfully
  • Err - If writing fails or translation errors occur

§Examples

use ssg::{create_log_file, log_initialization};

fn main() -> anyhow::Result<()> {
    let mut log_file = create_log_file("./site.log")?;
    let date = ssg::now_iso();

    log_initialization(&mut log_file, &date)?;
    println!("System initialisation logged");
    Ok(())
}