Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 7, 2024
1 parent 11149d8 commit 0b899f7
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 8 deletions.
143 changes: 142 additions & 1 deletion 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 @@ -29,6 +29,7 @@ sysinfo = "0.33"
tokio = { version = "1", features = ["full"] }
toml = { version = "0.8", features = ["indexmap", "preserve_order"] }
xx = { version = "2", features = ["fslock", "hash"] }
chrono = "0.4.38"

[target.'cfg(unix)'.dependencies]
exec = "0.3"
19 changes: 12 additions & 7 deletions src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ impl log::Log for Logger {
if record.level() <= self.file_level {
if let Some(log_file) = &self.log_file {
let mut log_file = log_file.lock().unwrap();
let out = self.render(record, self.file_level);
let out = format!(
"{now} {level} {args}",
now = chrono::Local::now().format("%Y-%m-%d %H:%M:%S"),
level = self.styled_level(record.level()),
args = record.args()
);
let _ = writeln!(log_file, "{}", console::strip_ansi_codes(&out));
}
}
Expand Down Expand Up @@ -85,15 +90,15 @@ impl Logger {
args = record.args()
),
_ => {
let mise = match record.level() {
Level::Error => ui::style::ered("mise"),
Level::Warn => ui::style::eyellow("mise"),
_ => ui::style::edim("mise"),
let pitchfork = match record.level() {
Level::Error => ui::style::ered("pitchfork"),
Level::Warn => ui::style::eyellow("pitchfork"),
_ => ui::style::edim("pitchfork"),
};
match record.level() {
Level::Info => format!("{mise} {args}", args = record.args()),
Level::Info => format!("{pitchfork} {args}", args = record.args()),
_ => format!(
"{mise} {level} {args}",
"{pitchfork} {level} {args}",
level = self.styled_level(record.level()),
args = record.args()
),
Expand Down

0 comments on commit 0b899f7

Please sign in to comment.