Improve initial log file (#105)

This commit is contained in:
Thorsten Sommer 2024-09-03 16:13:57 +02:00 committed by GitHub
parent e4b8487945
commit 12602ba8dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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)
@ -155,6 +163,9 @@ async fn main() {
.start().expect("Cannot start logging");
info!("Starting MindWork AI Studio:");
let working_directory = std::env::current_dir().unwrap();
info!(".. The working directory is: '{working_directory:?}'");
info!(".. Version: v{app_version} (commit {app_commit_hash}, build {build_number})");
info!(".. Build time: {build_time}");
info!(".. .NET SDK: v{dotnet_sdk_version}");
@ -190,7 +201,7 @@ async fn main() {
let mut shutdown = Shutdown {
// We do not want to use the Ctrl+C signal to stop the server:
ctrlc: false,
// Everything else is set to default for now:
..Shutdown::default()
};