moved logs to folder, and excluded them from git

This commit is contained in:
Nickiel12 2024-05-30 11:45:04 -07:00
parent 6aa1c8789d
commit 386e632efb
3 changed files with 11 additions and 21 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/target
settings.toml
.direnv/*
logs/*

View file

@ -1,4 +1,4 @@
camera_ip = "10.0.0.33"
camera_ip = "localhost"
camera_port = 8765
tracker_ip = "localhost"
tracker_port = 6543

View file

@ -3,8 +3,6 @@ use gtk::{glib, Application};
use std::{env, sync::Arc};
use tokio::{runtime, sync::RwLock};
use tracing::{self, info, Level};
#[cfg(not(debug_assertions))]
use tracing_appender;
use tracing_subscriber;
use crate::config::{load_config, AppConfig};
@ -20,24 +18,15 @@ const APP_ID: &str = "net.nickiel.joystick-controller-client";
fn main() -> glib::ExitCode {
// set the environment var to make gtk use window's default action bar
env::set_var("gtk_csd", "0");
#[cfg(not(debug_assertions))]
{
let file_appender = tracing_appender::rolling::daily(".", "joystick-log");
let (non_blocking, _gaurd) = tracing_appender::non_blocking(file_appender);
tracing_subscriber::fmt()
.with_writer(non_blocking)
.with_max_level(tracing::Level::DEBUG)
.init();
}
#[cfg(debug_assertions)]
{
tracing_subscriber::fmt()
// .compact()
.pretty()
.with_max_level(tracing::Level::DEBUG)
.init();
}
// #[cfg(not(debug_assertions))]
let file_appender = tracing_appender::rolling::daily(".\\logs", "camera-controller");
let (non_blocking, _gaurd) = tracing_appender::non_blocking(file_appender);
tracing_subscriber::fmt()
.with_writer(non_blocking)
.with_max_level(tracing::Level::DEBUG)
.with_ansi(false)
.init();
let span = tracing::span!(Level::TRACE, "main");
let _enter = span.enter();