Merge branch 'log-proc-name' into 'master'
Append program name in log See merge request redox-os/relibc!1005
This commit is contained in:
@@ -2,7 +2,7 @@ use core::{fmt, str::FromStr};
|
||||
|
||||
use crate::{c_str::CStr, io::prelude::*, sync::Mutex};
|
||||
|
||||
use alloc::string::String;
|
||||
use alloc::string::{String, ToString};
|
||||
use log::{Metadata, Record};
|
||||
|
||||
const DEFAULT_LOG_LEVEL: log::LevelFilter = log::LevelFilter::Info;
|
||||
@@ -23,6 +23,10 @@ pub unsafe fn init() {
|
||||
logger = logger.with_output(OutputBuilder::stderr().with_filter(level).build());
|
||||
}
|
||||
}
|
||||
if let Some(name) = CStr::from_nullable_ptr(crate::platform::program_invocation_short_name)
|
||||
{
|
||||
logger = logger.with_process_name(name.to_str().unwrap_or("").to_string());
|
||||
}
|
||||
}
|
||||
if logger.enable().is_err() {
|
||||
log::error!("Logger already initialized");
|
||||
|
||||
+1
-2
@@ -115,7 +115,6 @@ extern "C" fn init_array() {
|
||||
|
||||
unsafe {
|
||||
crate::pthread::init();
|
||||
crate::platform::logger::init();
|
||||
init_complete = true
|
||||
}
|
||||
}
|
||||
@@ -218,8 +217,8 @@ pub unsafe extern "C" fn relibc_start_v1(
|
||||
|
||||
let auxvs = unsafe { get_auxvs(sp.auxv().cast()) };
|
||||
unsafe { crate::platform::init(auxvs) };
|
||||
|
||||
init_array();
|
||||
unsafe { crate::platform::logger::init() };
|
||||
|
||||
// Run preinit array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user