-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlogging.h
More file actions
56 lines (30 loc) · 1001 Bytes
/
logging.h
File metadata and controls
56 lines (30 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __NETPIPE_LOGGING_H__
#define __NETPIPE_LOGGING_H__
#define LOG_FLAG_ERROR 1
#define LOG_FLAG_WARNING 2
#define LOG_FLAG_INFO 4
#define LOG_FLAG_PACKET 8
#define LOG_FLAG_PACKET_DATA 0x10
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern uint32_t _loggingFlags;
#ifdef _WIN32
#define Log(aLevel, aFormat, ...) \
LogMsg(aLevel, "[%u]: " aFormat "\n", GetCurrentThreadId(), __VA_ARGS__)
#else
#define Log(aLevel, aFormat, ...) \
LogMsg(aLevel, "[%u]: " aFormat "\n", getpid(), __VA_ARGS__)
#endif
#define LogError(aFormat, ...) \
Log(LOG_FLAG_ERROR, aFormat, __VA_ARGS__ + 0)
#define LogWarning(aFormat, ...) \
Log(LOG_FLAG_WARNING, aFormat, __VA_ARGS__ + 0)
#define LogInfo(aFormat, ...) \
Log(LOG_FLAG_INFO, aFormat, __VA_ARGS__ + 0)
#define LogPacket(aFormat, ...) \
Log(LOG_FLAG_PACKET, aFormat, __VA_ARGS__ + 0)
void LogMsg(uint32_t Level, const char *Format, ...);
int LogSetFile(const char *FileName);
#endif