show_file_info_examples

Function show_file_info_examples 

Source
pub fn show_file_info_examples()
Expand description

Display example log messages with file information.

Compares how logs appear with and without file/line information. This helps visualize the difference between development logs (with file info) and production logs (without file info).

Examples found in repository?
examples/color_options.rs (line 17)
5fn main() {
6    // First demonstrate the difference between colored and plain text logs
7    println!("# Log Format Comparison\n");
8    println!("This example shows different log formats side by side.\n");
9
10    // Show plain text logs
11    show_plain_log_examples();
12
13    // Show colored logs
14    show_colored_log_examples();
15
16    // Show the difference with and without file information
17    show_file_info_examples();
18
19    println!("Note: This demonstration shows how logs appear with different configurations.");
20    println!("In actual usage, you would use one of these approaches:");
21    println!("  - init_logger(path) // Simple initialization with defaults");
22    println!("  - init_logger_with_level(path, level) // Set specific log level");
23    println!("  - init_simple_stdout_logger(level) // Simple stdout-only logger");
24    println!("  - init_production_logger(path) // Production optimized (no file info)");
25    println!("  - init_development_logger(path) // Development optimized (with file info)");
26    println!("\nOr create a custom configuration:");
27    println!("  let config = LoggerConfig::builder()");
28    println!("    .level(LevelFilter::Debug)");
29    println!("    .show_file_info(false)  // Hide file info for cleaner output");
30    println!("    .show_date_in_stdout(false) // Show only time in stdout");
31    println!("    .use_colors(true)  // Enable colored output");
32    println!("    .build();");
33    println!("  init_logger_with_config(path, config)");
34}