Skip to content

Commit

Permalink
fix(core): generate error if event log failed, rather than panic (#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Jan 31, 2024
1 parent 2bc0923 commit 5fcd8c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/tabby/src/services/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use tokio::{
sync::mpsc::{unbounded_channel, UnboundedSender},
time::{self},
};
use tracing::error;

lazy_static! {
static ref WRITER: UnboundedSender<String> = {
Expand Down Expand Up @@ -99,7 +100,9 @@ struct EventService;

impl RawEventLogger for EventService {
fn log(&self, content: String) {
WRITER.send(content).unwrap();
if let Err(err) = WRITER.send(content) {
error!("Failed to write event to file: {}", err);
}
}
}

Expand Down

0 comments on commit 5fcd8c9

Please sign in to comment.