smokestack: add colours
This commit is contained in:
parent
0d179e3624
commit
52c5597459
|
@ -26,6 +26,15 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_term"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.66"
|
version = "1.0.66"
|
||||||
|
@ -316,6 +325,7 @@ dependencies = [
|
||||||
name = "caveman-smokestack"
|
name = "caveman-smokestack"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
"cave",
|
"cave",
|
||||||
"futures",
|
"futures",
|
||||||
"log",
|
"log",
|
||||||
|
|
|
@ -9,13 +9,6 @@ futures = "0.3"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
# serde_yaml = "0.9"
|
|
||||||
# chrono = "0.4"
|
|
||||||
# redis = { version = "0.22", features = ["tokio-comp", "connection-manager"] }
|
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
cave = { path = "../cave" }
|
cave = { path = "../cave" }
|
||||||
# hyper = { version = "0.14", features = ["stream"] }
|
ansi_term = "0.12"
|
||||||
# axum = "0.5"
|
|
||||||
# axum-macros = "0.2"
|
|
||||||
# axum-extra = { version = "0.3", features = ["spa"] }
|
|
||||||
# askama = "0.11"
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ use std::{
|
||||||
RwLock,
|
RwLock,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use ansi_term::Colour::*;
|
||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::AsyncWriteExt,
|
io::AsyncWriteExt,
|
||||||
|
@ -62,11 +63,11 @@ fn format_message(post: Post) -> Option<String> {
|
||||||
let text = html_to_text(&post.content);
|
let text = html_to_text(&post.content);
|
||||||
Some(format!(
|
Some(format!(
|
||||||
"[{}] {} {} <@{}@{}>\r\n{}\r\n\r\n",
|
"[{}] {} {} <@{}@{}>\r\n{}\r\n\r\n",
|
||||||
language,
|
Black.on(Red).paint(language),
|
||||||
time,
|
Red.paint(time),
|
||||||
display_name,
|
Yellow.bold().paint(display_name),
|
||||||
username,
|
Yellow.underline().paint(username),
|
||||||
host,
|
Yellow.underline().paint(host),
|
||||||
text,
|
text,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue