feat(core): log system info to make debugging easier

This commit is contained in:
Federico Terzi 2022-07-03 12:04:05 +02:00
parent 80c05c8939
commit 74f9deccb0
2 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,7 @@ use simplelog::{
use crate::{
cli::{LogMode, PathsOverrides},
config::load_config,
util::log_system_info,
};
mod capabilities;
@ -586,6 +587,7 @@ For example, specifying 'email' is equivalent to 'match/email.yml'."#))
info!("reading configs from: {:?}", paths.config);
info!("reading packages from: {:?}", paths.packages);
info!("using runtime dir: {:?}", paths.runtime);
log_system_info();
if handler.requires_config {
let config_result =

View File

@ -17,7 +17,9 @@
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
*/
use log::info;
use std::process::Command;
use sysinfo::{System, SystemExt};
#[cfg(target_os = "windows")]
pub fn set_command_flags(command: &mut Command) {
@ -43,3 +45,13 @@ pub fn attach_console() {
pub fn attach_console() {
// Not necessary on Linux and macOS
}
pub fn log_system_info() {
let sys = System::new();
info!(
"system info: {} v{} - kernel: {}",
sys.name().unwrap_or_default(),
sys.os_version().unwrap_or_default(),
sys.kernel_version().unwrap_or_default()
);
}