summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2024-03-18 17:29:11 +0200
committerLars Wirzenius <liw@liw.fi>2024-03-18 18:16:05 +0200
commit0935bbdbbeec1b9334d9c1098c25cf60b8ebcae8 (patch)
tree503da46e23b3d3ac321879a6684b79f2bd8488bc
parent706d92b9c2f4c675237ec9e083f1106df24e1a3d (diff)
downloadradicle-ci-broker-0935bbdbbeec1b9334d9c1098c25cf60b8ebcae8.tar.gz
feat: adjust logging to stderr via pretty_env_loggerHEADmain
Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rw-r--r--src/bin/ci-broker.rs2
-rw-r--r--src/broker.rs4
-rw-r--r--src/db.rs6
3 files changed, 8 insertions, 4 deletions
diff --git a/src/bin/ci-broker.rs b/src/bin/ci-broker.rs
index f8f4da0..f335e4b 100644
--- a/src/bin/ci-broker.rs
+++ b/src/bin/ci-broker.rs
@@ -104,7 +104,7 @@ fn fallible_main() -> Result<(), BrokerError> {
debug!("waiting for event from node");
for e in source.event()? {
page.broker_event(&e);
- debug!("broker event {e:#?}");
+ info!("broker event {e:#?}");
let req = RequestBuilder::default()
.profile(&profile)
.broker_event(&e)
diff --git a/src/broker.rs b/src/broker.rs
index 6daa2c2..d2ab970 100644
--- a/src/broker.rs
+++ b/src/broker.rs
@@ -5,7 +5,7 @@
use std::{collections::HashMap, path::Path};
-use log::debug;
+use log::{debug, info};
use time::{macros::format_description, OffsetDateTime};
use radicle::prelude::RepoId;
@@ -69,6 +69,7 @@ impl Broker {
trigger: &Request,
status: &mut StatusPage,
) -> Result<Run, BrokerError> {
+ info!("Start CI run on {trigger:#?}");
let run = match trigger {
Request::Trigger {
common,
@@ -103,6 +104,7 @@ impl Broker {
}
};
self.db.push_run(&run)?;
+ info!("Finish CI run: {run:#?}");
Ok(run)
}
diff --git a/src/db.rs b/src/db.rs
index b190828..d6b8afb 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -5,6 +5,7 @@ use std::{
path::{Path, PathBuf},
};
+use log::info;
use sqlite::{Connection, State};
use crate::run::Run;
@@ -29,13 +30,14 @@ impl fmt::Debug for Db {
impl Db {
pub fn new(filename: &Path) -> Result<Self, DbError> {
- eprintln!("open {}", filename.display());
+ info!("open database {}", filename.display());
let conn = sqlite::open(filename).map_err(|e| DbError::open(filename, e))?;
- eprintln!("create tables");
+ info!("create tables");
conn.execute(CREATE_TABLES)
.map_err(|e| DbError::create_tables(CREATE_TABLES, e))?;
+ info!("database setup OK");
Ok(Db {
conn,
filename: filename.into(),