NkFoundationLog.h
Include
#include "NKPlatform/NkFoundationLog.h"Namespace
nkentseu::platformLink (Jenga)
nkentseudependson(["NKPlatform"])Functions · 2
NkFoundationSetLogSink | Sets a custom log sink |
NkFoundationGetLogSink | Gets the log sink currently configured |
Aliases · 1
NkFoundationLogSink | Function type for the custom log sink |
Variables · 1
gNkFoundationLogSink | Global log sink configured by the user |
Macros · 21
NK_FOUNDATION_HAS_ANDROID_LOG | Flag for Android Log availability |
NK_FOUNDATION_RESTORE_LOGGER_MACRO | |
NK_FOUNDATION_LOG_LEVEL_NONE | Log level: no log |
NK_FOUNDATION_LOG_LEVEL_ERROR | Log level: critical errors |
NK_FOUNDATION_LOG_LEVEL_WARN | Log level: warnings |
NK_FOUNDATION_LOG_LEVEL_INFO | Log level: general information |
NK_FOUNDATION_LOG_LEVEL_DEBUG | Log level: debug messages |
NK_FOUNDATION_LOG_LEVEL_TRACE | Log level: detailed traces (very verbose) |
NK_FOUNDATION_LOG_LEVEL | Log level active at compile time |
NK_FOUNDATION_PRINT | Generic log macro (INFO level) |
NK_FOUNDATION_SPRINT | Safe sprintf-style formatting macro |
NK_FOUNDATION_LOG_ERROR | ERROR level log macro |
NK_FOUNDATION_LOG_WARN | WARN level log macro |
NK_FOUNDATION_LOG_INFO | INFO level log macro |
NK_FOUNDATION_LOG_DEBUG | DEBUG level log macro |
NK_FOUNDATION_LOG_TRACE | TRACE level log macro |
NK_FOUNDATION_LOG_ERROR_VALUE | ERROR level log macro for a labelled value |
NK_FOUNDATION_LOG_WARN_VALUE | WARN level log macro for a labelled value |
NK_FOUNDATION_LOG_INFO_VALUE | INFO level log macro for a labelled value |
NK_FOUNDATION_LOG_DEBUG_VALUE | DEBUG level log macro for a labelled value |
NK_FOUNDATION_LOG_TRACE_VALUE | TRACE level log macro for a labelled value |
Member details
#define NK_FOUNDATION_HAS_ANDROID_LOG
Flag for Android Log availability
Source : NkFoundationLog.h, line 57
#define NK_FOUNDATION_RESTORE_LOGGER_MACRO
Source : NkFoundationLog.h, line 80
#define NK_FOUNDATION_LOG_LEVEL_NONE
Log level: no log
Source : NkFoundationLog.h, line 104
#define NK_FOUNDATION_LOG_LEVEL_ERROR
Log level: critical errors
Source : NkFoundationLog.h, line 112
#define NK_FOUNDATION_LOG_LEVEL_WARN
Log level: warnings
Source : NkFoundationLog.h, line 120
#define NK_FOUNDATION_LOG_LEVEL_INFO
Log level: general information
Source : NkFoundationLog.h, line 128
#define NK_FOUNDATION_LOG_LEVEL_DEBUG
Log level: debug messages
Source : NkFoundationLog.h, line 136
#define NK_FOUNDATION_LOG_LEVEL_TRACE
Log level: detailed traces (very verbose)
Source : NkFoundationLog.h, line 144
#define NK_FOUNDATION_LOG_LEVEL
Log level active at compile time
#define NK_FOUNDATION_LOG_LEVEL NK_FOUNDATION_LOG_LEVEL_TRACE #include "NKPlatform/NkFoundationLog.h"
Source : NkFoundationLog.h, line 165
using NkFoundationLogSink = void (*)(const char *level, const char *file, int line, const char *message)
Function type for the custom log sink
void MyCustomSink(const char* level, const char* file, int line, const char* message) { // Envoyer vers un serveur de logs, écrire dans un fichier, etc. fprintf(myLogFile, "[%s] %s:%d %s\n", level, file, line, message); } NkFoundationSetLogSink(MyCustomSink);
Source : NkFoundationLog.h, line 211
extern NkFoundationLogSink gNkFoundationLogSink
Global log sink configured by the user
Source : NkFoundationLog.h, line 226
void NkFoundationSetLogSink(NkFoundationLogSink sink)
Sets a custom log sink
Parameters
| Name | Type | Role | Default |
|---|---|---|---|
sink | NkFoundationLogSink |
// Définir un sink personnalisé au démarrage de l'application NkFoundationSetLogSink(MyFileLogger); // Réinitialiser vers le backend par défaut NkFoundationSetLogSink(nullptr);
Source : NkFoundationLog.h, line 262
NkFoundationLogSink NkFoundationGetLogSink()
Gets the log sink currently configured
Source : NkFoundationLog.h, line 273
#define NK_FOUNDATION_PRINT(fmt, ...)
Generic log macro (INFO level)
NK_FOUNDATION_PRINT("Initialisation de la bibliothèque v%d.%d", 1, 2);
Source : NkFoundationLog.h, line 667
#define NK_FOUNDATION_SPRINT(buffer, bufferSize, fmt, ...)
Safe sprintf-style formatting macro
Source : NkFoundationLog.h, line 684
#define NK_FOUNDATION_LOG_ERROR(fmt, ...)
ERROR level log macro
if (!file.Open("config.ini")) { NK_FOUNDATION_LOG_ERROR("Échec d'ouverture: %s", file.GetLastError()); return false; }
Source : NkFoundationLog.h, line 708
#define NK_FOUNDATION_LOG_WARN(fmt, ...)
WARN level log macro
Source : NkFoundationLog.h, line 725
#define NK_FOUNDATION_LOG_INFO(fmt, ...)
INFO level log macro
Source : NkFoundationLog.h, line 742
#define NK_FOUNDATION_LOG_DEBUG(fmt, ...)
DEBUG level log macro
Source : NkFoundationLog.h, line 759
#define NK_FOUNDATION_LOG_TRACE(fmt, ...)
TRACE level log macro
Source : NkFoundationLog.h, line 776
#define NK_FOUNDATION_LOG_ERROR_VALUE(label, value)
ERROR level log macro for a labelled value
NK_FOUNDATION_LOG_ERROR_VALUE("errorCode", result); // Sortie : [ERR] myfile.cpp:42 errorCode=-1
Source : NkFoundationLog.h, line 802
#define NK_FOUNDATION_LOG_WARN_VALUE(label, value)
WARN level log macro for a labelled value
Source : NkFoundationLog.h, line 816
#define NK_FOUNDATION_LOG_INFO_VALUE(label, value)
INFO level log macro for a labelled value
Source : NkFoundationLog.h, line 830
#define NK_FOUNDATION_LOG_DEBUG_VALUE(label, value)
DEBUG level log macro for a labelled value
Source : NkFoundationLog.h, line 844
#define NK_FOUNDATION_LOG_TRACE_VALUE(label, value)
TRACE level log macro for a labelled value
Source : NkFoundationLog.h, line 858