Hide the initial log file on Unix-like systems

This commit is contained in:
Thorsten Sommer 2024-09-03 16:09:33 +02:00
parent e4b8487945
commit f323c85276
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -142,9 +142,17 @@ async fn main() {
// Set the log level for the Reqwest library:
log_config.push_str("reqwest::async_impl::client=info");
// Configure the initial filename. On Unix systems, the file should start
// with a dot to be hidden.
let log_basename = match cfg!(unix)
{
true => ".AI Studio Events",
false => "AI Studio Events",
};
let logger = Logger::try_with_str(log_config).expect("Cannot create logging")
.log_to_file(FileSpec::default()
.basename("AI Studio Events")
.basename(log_basename)
.suppress_timestamp()
.suffix("log"))
.duplicate_to_stdout(Duplicate::All)