20#ifndef _POSIX_KERNEL_LOGGING_H
21#define _POSIX_KERNEL_LOGGING_H
22#include "pedigree/kernel/process/Process.h"
23#include "pedigree/kernel/process/Thread.h"
24#include "pedigree/kernel/processor/Processor.h"
30#define POSIX_VERBOSE_LOG(f, x) \
32 auto ____tid = Processor::information().getCurrentThread()->getId(); \
33 auto ____level = Processor::information().getCurrentThread()->getStateLevel(); \
34 auto ____pid = Processor::information().getCurrentThread()->getParent()->getId(); \
35 NOTICE("[" << f << ":\t" << Dec << ____pid << ":" << ____tid << "." << ____level << Hex \
39#define POSIX_VERBOSE_LOG(f, x) \
41 NOTICE("[" << f << "]\t" << x); \
46#ifndef POSIX_LOG_FACILITIES
47#define POSIX_LOG_FACILITIES 0
50#define POSIX_LOG_IF(mask, facility, text) \
52 EMIT_IF((POSIX_LOG_FACILITIES & (mask)) == (mask)) { \
53 POSIX_VERBOSE_LOG(facility, text); \
57#define SC_NOTICE(x) POSIX_LOG_IF(2, "sys", x)
58#define F_NOTICE(x) POSIX_LOG_IF(1, "io", x)
59#define PT_NOTICE(x) POSIX_LOG_IF(4, "thr", x)
60#define N_NOTICE(x) POSIX_LOG_IF(8, "net", x)
61#define SG_NOTICE(x) POSIX_LOG_IF(32, "sig", x)
62#define PS_NOTICE(x) POSIX_LOG_IF(16, "sub", x)
63#define SG_VERBOSE_NOTICE(x) POSIX_LOG_IF(32 | 64, "sig", x)
64#define POLL_NOTICE(x) POSIX_LOG_IF(256, "poll", x)