Skip to content

Commit

Permalink
Move VERSION constant to lib
Browse files Browse the repository at this point in the history
  • Loading branch information
hillu committed Dec 12, 2023
1 parent bd04eda commit 134c1b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/bin/laurel/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ impl Logger {
}
}

const LAUREL_VERSION: &str = env!("CARGO_PKG_VERSION");

fn run_app() -> Result<(), Box<dyn Error>> {
let args: Vec<String> = env::args().collect();

Expand All @@ -153,7 +151,7 @@ fn run_app() -> Result<(), Box<dyn Error>> {
}

if matches.opt_present("v") {
println!("{}", LAUREL_VERSION);
println!("{}", laurel::VERSION);
return Ok(());
}

Expand Down Expand Up @@ -205,7 +203,7 @@ fn run_app() -> Result<(), Box<dyn Error>> {
};

if matches.opt_present("d") {
println!("Laurel {}: Config ok.", LAUREL_VERSION);
println!("Laurel {}: Config ok.", laurel::VERSION);
return Ok(());
}

Expand Down Expand Up @@ -281,7 +279,7 @@ fn run_app() -> Result<(), Box<dyn Error>> {

// Initial setup is done at this point.

log::info!("Started {} running version {}", &args[0], LAUREL_VERSION);
log::info!("Started {} running version {}", &args[0], laurel::VERSION);
log::info!(
"Running with EUID {} using config {}",
Uid::effective().as_raw(),
Expand Down Expand Up @@ -402,7 +400,7 @@ fn run_app() -> Result<(), Box<dyn Error>> {
if statusreport_period_t.as_secs() > 0
&& statusreport_last_t.elapsed()? >= statusreport_period_t
{
log::info!("Laurel version {}", LAUREL_VERSION);
log::info!("Laurel version {}", laurel::VERSION);
log::info!(
"Parsing stats (until now): processed {} lines {} events with {} errors in total",
&stats.lines, &stats.events, &stats.errors );
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

pub mod coalesce;
pub mod config;
pub mod constants;
Expand Down

0 comments on commit 134c1b1

Please sign in to comment.