mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:17:35 +00:00
AK: Unify kernel debug messages, avoid printing time if unavailable
This commit is contained in:
parent
5791072280
commit
9b12571a86
1 changed files with 10 additions and 9 deletions
|
@ -886,10 +886,8 @@ void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
|
||||
#ifdef AK_OS_SERENITY
|
||||
# ifdef KERNEL
|
||||
if (Kernel::Processor::is_initialized()) {
|
||||
struct timespec ts = {};
|
||||
if (TimeManagement::is_initialized())
|
||||
ts = TimeManagement::the().monotonic_time(TimePrecision::Coarse).to_timespec();
|
||||
if (Kernel::Processor::is_initialized() && TimeManagement::is_initialized()) {
|
||||
struct timespec ts = TimeManagement::the().monotonic_time(TimePrecision::Coarse).to_timespec();
|
||||
if (Kernel::Thread::current()) {
|
||||
auto& thread = *Kernel::Thread::current();
|
||||
builder.appendff("{}.{:03} \033[34;1m[#{} {}({}:{})]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000, Kernel::Processor::current_id(), thread.process().name(), thread.pid().value(), thread.tid().value());
|
||||
|
@ -940,7 +938,7 @@ void vdmesgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
# ifdef AK_OS_SERENITY
|
||||
struct timespec ts = {};
|
||||
|
||||
if (TimeManagement::is_initialized())
|
||||
if (TimeManagement::is_initialized()) {
|
||||
ts = TimeManagement::the().monotonic_time(TimePrecision::Coarse).to_timespec();
|
||||
|
||||
if (Kernel::Processor::is_initialized() && Kernel::Thread::current()) {
|
||||
|
@ -949,6 +947,9 @@ void vdmesgln(StringView fmtstr, TypeErasedFormatParams& params)
|
|||
} else {
|
||||
builder.appendff("{}.{:03} \033[34;1m[Kernel]\033[0m: ", ts.tv_sec, ts.tv_nsec / 1000000);
|
||||
}
|
||||
} else {
|
||||
builder.appendff("\033[34;1m[Kernel]\033[0m: ");
|
||||
}
|
||||
# endif
|
||||
|
||||
MUST(vformat(builder, fmtstr, params));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue