Skip to content

Commit

Permalink
add time to log events
Browse files Browse the repository at this point in the history
  • Loading branch information
randommm committed Feb 4, 2024
1 parent 85656bd commit 40bcc99
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ hf-hub = "0.3.2"
tokenizers = "0.15"
thread-priority = "0.15"
regex = "1.5"
chrono = "0.4.33"

[profile.dev.package."*"]
opt-level = 3
7 changes: 5 additions & 2 deletions src/routes/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use axum::{
response::IntoResponse,
Json,
};
use chrono::Local;
use hmac::{Hmac, Mac};
use regex::Regex;
use reqwest::{header::AUTHORIZATION, multipart};
Expand Down Expand Up @@ -86,8 +87,9 @@ pub async fn try_process_slack_events(
let value = process_slack_events(slack_oauth_token, db_pool, &query).await;

if let Err(ref value) = value {
print!("{}: ", Local::now());
println!(
"Failed to process Slack event.\nGot error:\n{:?}\nGot payload:{:?} ",
"failed to process Slack event.\nGot error:\n{:?}\nGot payload:{:?} ",
value, query
);
}
Expand Down Expand Up @@ -127,7 +129,8 @@ async fn process_slack_events(
.unwrap_or(x.to_owned()),
None => "unknown".to_owned(),
};
print!("From user {user} at channel {channel} and type {type_}, received message: {text}. ");
print!("{}: ", Local::now());
print!("from user {user} at channel {channel} and type {type_}, received message: {text}. ");

let thread_ts = event.get("thread_ts");
let thread_ts = match thread_ts {
Expand Down

0 comments on commit 40bcc99

Please sign in to comment.