HyperPlatform Programmer's Reference
|
Declares interfaces to logging functions. More...
#include <fltKernel.h>
Go to the source code of this file.
Macros | |
#define | HYPERPLATFORM_LOG_DEBUG(format, ...) LogpPrint(kLogpLevelDebug, __FUNCTION__, (format), __VA_ARGS__) |
Logs a message as respective severity. More... | |
#define | HYPERPLATFORM_LOG_INFO(format, ...) LogpPrint(kLogpLevelInfo, __FUNCTION__, (format), __VA_ARGS__) |
#define | HYPERPLATFORM_LOG_WARN(format, ...) LogpPrint(kLogpLevelWarn, __FUNCTION__, (format), __VA_ARGS__) |
#define | HYPERPLATFORM_LOG_ERROR(format, ...) LogpPrint(kLogpLevelError, __FUNCTION__, (format), __VA_ARGS__) |
#define | HYPERPLATFORM_LOG_DEBUG_SAFE(format, ...) |
Buffers a message as respective severity. More... | |
#define | HYPERPLATFORM_LOG_INFO_SAFE(format, ...) |
#define | HYPERPLATFORM_LOG_WARN_SAFE(format, ...) |
#define | HYPERPLATFORM_LOG_ERROR_SAFE(format, ...) |
Functions | |
NTSTATUS | LogInitialization (_In_ ULONG flag, _In_opt_ const wchar_t *file_path) |
Initializes the log system. More... | |
void | LogRegisterReinitialization (_In_ PDRIVER_OBJECT driver_object) |
Registers re-initialization. More... | |
void | LogIrpShutdownHandler () |
Terminates the log system. Should be called from an IRP_MJ_SHUTDOWN handler. More... | |
void | LogTermination () |
Terminates the log system. Should be called from a DriverUnload routine. More... | |
NTSTATUS | LogpPrint (_In_ ULONG level, _In_z_ const char *function_name, _In_z_ _Printf_format_string_ const char *format,...) |
Logs a message; use HYPERPLATFORM_LOG_*() macros instead. More... | |
Variables | |
static const auto | kLogpLevelOptSafe = 0x1ul |
Save this log to buffer and not try to write to a log file. More... | |
static const auto | kLogpLevelDebug = 0x10ul |
Bit mask for DEBUG level logs. More... | |
static const auto | kLogpLevelInfo = 0x20ul |
Bit mask for INFO level logs. More... | |
static const auto | kLogpLevelWarn = 0x40ul |
Bit mask for WARN level logs. More... | |
static const auto | kLogpLevelError = 0x80ul |
Bit mask for ERROR level logs. More... | |
static const auto | kLogPutLevelDebug |
For LogInitialization(). Enables all levels of logs. More... | |
static const auto | kLogPutLevelInfo |
For LogInitialization(). Enables ERROR, WARN and INFO levels of logs. More... | |
static const auto | kLogPutLevelWarn = kLogpLevelError | kLogpLevelWarn |
For LogInitialization(). Enables ERROR and WARN levels of logs. More... | |
static const auto | kLogPutLevelError = kLogpLevelError |
For LogInitialization(). Enables an ERROR level of logs. More... | |
static const auto | kLogPutLevelDisable = 0x00ul |
For LogInitialization(). Disables all levels of logs. More... | |
static const auto | kLogOptDisableTime = 0x100ul |
For LogInitialization(). Do not log a current time. More... | |
static const auto | kLogOptDisableFunctionName = 0x200ul |
For LogInitialization(). Do not log a current function name. More... | |
static const auto | kLogOptDisableProcessorNumber = 0x400ul |
For LogInitialization(). Do not log a current processor number. More... | |
static const auto | kLogOptDisableDbgPrint = 0x800ul |
For LogInitialization(). Do not log to debug buffer. More... | |
Declares interfaces to logging functions.
Definition in file log.h.
#define HYPERPLATFORM_LOG_DEBUG | ( | format, | |
... | |||
) | LogpPrint(kLogpLevelDebug, __FUNCTION__, (format), __VA_ARGS__) |
Logs a message as respective severity.
format | A format string |
Debug prints or buffers a log message with information about current execution context such as time, PID and TID as respective severity. Here are some guide lines to decide which level is appropriate:
A message should not exceed 512 bytes after all string construction is done; otherwise this macro fails to log and returns non STATUS_SUCCESS.
#define HYPERPLATFORM_LOG_DEBUG_SAFE | ( | format, | |
... | |||
) |
Buffers a message as respective severity.
format | A format string |
Buffers the log to buffer and neither calls DbgPrint() nor writes to a file. It is strongly recommended to use it when a status of a system is not expectable in order to avoid system instability.
#define HYPERPLATFORM_LOG_ERROR | ( | format, | |
... | |||
) | LogpPrint(kLogpLevelError, __FUNCTION__, (format), __VA_ARGS__) |
#define HYPERPLATFORM_LOG_ERROR_SAFE | ( | format, | |
... | |||
) |
#define HYPERPLATFORM_LOG_INFO | ( | format, | |
... | |||
) | LogpPrint(kLogpLevelInfo, __FUNCTION__, (format), __VA_ARGS__) |
#define HYPERPLATFORM_LOG_INFO_SAFE | ( | format, | |
... | |||
) |
#define HYPERPLATFORM_LOG_WARN | ( | format, | |
... | |||
) | LogpPrint(kLogpLevelWarn, __FUNCTION__, (format), __VA_ARGS__) |
#define HYPERPLATFORM_LOG_WARN_SAFE | ( | format, | |
... | |||
) |
NTSTATUS LogInitialization | ( | _In_ ULONG | flag, |
_In_opt_ const wchar_t * | file_path | ||
) |
Initializes the log system.
flag | A OR-ed flag to control a log level and options |
file_path | A log file path |
Allocates internal log buffers, initializes related resources, starts a log flush thread and creates a log file if requested. This function returns STATUS_REINITIALIZATION_NEEDED if a file-system is not initialized yet. In that case, a driver must call LogRegisterReinitialization() for completing initialization.
flag is a OR-ed value of kLogPutLevel* and kLogOpt*. For example, kLogPutLevelDebug | kLogOptDisableFunctionName.
void LogIrpShutdownHandler | ( | ) |
NTSTATUS LogpPrint | ( | _In_ ULONG | level, |
_In_z_ const char * | function_name, | ||
_In_z_ _Printf_format_string_ const char * | format, | ||
... | |||
) |
Logs a message; use HYPERPLATFORM_LOG_*() macros instead.
level | Severity of a message |
function_name | A name of a function called this function |
format | A format string |
void LogRegisterReinitialization | ( | _In_ PDRIVER_OBJECT | driver_object | ) |
Registers re-initialization.
driver_object | A driver object being loaded |
A driver must call this function, or call LogTermination() and return non STATUS_SUCCESS from DriverEntry() if LogInitialization() returned STATUS_REINITIALIZATION_NEEDED. If this function is called, DriverEntry() must return STATUS_SUCCESS.
void LogTermination | ( | ) |
|
static |
For LogInitialization(). Do not log to debug buffer.
|
static |
For LogInitialization(). Do not log a current function name.
|
static |
For LogInitialization(). Do not log a current processor number.
|
static |
For LogInitialization(). Do not log a current time.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
For LogInitialization(). Enables all levels of logs.
|
static |
For LogInitialization(). Disables all levels of logs.
|
static |
For LogInitialization(). Enables an ERROR level of logs.
|
static |
For LogInitialization(). Enables ERROR, WARN and INFO levels of logs.
|
static |
For LogInitialization(). Enables ERROR and WARN levels of logs.