25 lines
495 B
C++
25 lines
495 B
C++
/*
|
|
* service_log.h
|
|
* Common logging policy for MontaukOS userspace services.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <montauk/syscall.h>
|
|
|
|
namespace montauk {
|
|
|
|
// Append one newline-free message to the system log. When the service was
|
|
// launched from a userspace terminal, echo the same message there as well.
|
|
inline void service_log(const char* message) {
|
|
if (message == nullptr) return;
|
|
|
|
write_log(message);
|
|
if (terminal_attached()) {
|
|
print(message);
|
|
print("\n");
|
|
}
|
|
}
|
|
|
|
}
|