-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.rs
43 lines (37 loc) · 1.33 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#[macro_use]
extern crate tracing;
use chrono::{Local, Offset};
#[cfg(feature = "title")]
use crossterm::{execute, terminal::SetTitle};
use terminal_link::Link;
use time::{macros::format_description, UtcOffset};
use tracing::level_filters::LevelFilter;
use tracing_subscriber::{fmt::time::OffsetTime, EnvFilter};
use vrc_log::{vrchat::VRChat, CARGO_PKG_HOMEPAGE};
fn main() -> anyhow::Result<()> {
#[cfg(feature = "title")]
execute!(std::io::stdout(), SetTitle("VRC-LOG"))?;
/* Debugging: RUST_LOG=vrc_log=debug */
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::builder()
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy(),
)
.with_target(false)
.with_timer(OffsetTime::new(
UtcOffset::from_whole_seconds(Local::now().offset().fix().local_minus_utc())?,
format_description!("[hour repr:12]:[minute]:[second] [period]"),
))
.init();
if vrc_log::check_for_updates()? {
let text = "An update is available";
let link = Link::new(text, CARGO_PKG_HOMEPAGE);
info!("{link}");
}
let args = std::env::args();
let vrchat = VRChat::load()?;
let watcher = vrc_log::watch(vrchat.cache_directory)?;
vrc_log::launch_game(args)?;
vrc_log::process_avatars(watcher)
}