log.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef LOG_H__
  2. #define LOG_H__
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif
  6. #include "mathtypes.h"
  7. #include "messages.h"
  8. typedef enum
  9. {
  10. DEVELOPER_LEVEL_ALWAYS,
  11. DEVELOPER_LEVEL_ERROR,
  12. DEVELOPER_LEVEL_WARNING,
  13. DEVELOPER_LEVEL_MESSAGE,
  14. DEVELOPER_LEVEL_FLUFF,
  15. DEVELOPER_LEVEL_SPAM,
  16. DEVELOPER_LEVEL_MEGASPAM
  17. }
  18. developer_level_t;
  19. //
  20. // log.c globals
  21. //
  22. extern char* g_Program;
  23. extern char g_Mapname[_MAX_PATH];
  24. #define DEFAULT_DEVELOPER DEVELOPER_LEVEL_ALWAYS
  25. #define DEFAULT_VERBOSE false
  26. #define DEFAULT_LOG true
  27. extern developer_level_t g_developer;
  28. extern bool g_verbose;
  29. extern bool g_log;
  30. extern unsigned long g_clientid; // Client id of this program
  31. extern unsigned long g_nextclientid; // Client id of next client to spawn from this server
  32. //
  33. // log.c Functions
  34. //
  35. extern void ResetTmpFiles();
  36. extern void ResetLog();
  37. extern void ResetErrorLog();
  38. extern void CheckForErrorLog();
  39. extern void CDECL OpenLog(int clientid);
  40. extern void CDECL CloseLog();
  41. extern void WriteLog(const char* const message);
  42. extern void CheckFatal();
  43. extern void CDECL Developer(developer_level_t level, const char* const message, ...);
  44. #ifdef _DEBUG
  45. #define IfDebug(x) (x)
  46. #else
  47. #define IfDebug(x)
  48. #endif
  49. extern void CDECL Verbose(const char* const message, ...);
  50. extern void CDECL Log(const char* const message, ...);
  51. extern void CDECL Error(const char* const error, ...);
  52. extern void CDECL Fatal(assume_msgs msgid, const char* const error, ...);
  53. extern void CDECL Warning(const char* const warning, ...);
  54. extern void CDECL PrintOnce(const char* const message, ...);
  55. extern void LogStart(const int argc, char** argv);
  56. extern void LogEnd();
  57. extern void Banner();
  58. extern void LogTimeElapsed(float elapsed_time);
  59. // SILENCER -->
  60. // Note: When compile tools are run through a batch-file, some colors will
  61. // be different from Windows defaults; since you'd usually only run through
  62. // a batch file, these colors shall be used here:
  63. #define CONCOLOR_BGDEF_BLACK 0x0
  64. #define CONCOLOR_DBLUE 0x1
  65. #define CONCOLOR_DGREEN 0x2
  66. #define CONCOLOR_BLUEGREEN 0x3
  67. #define CONCOLOR_DRED 0x4
  68. #define CONCOLOR_DMAGENTA 0x5
  69. #define CONCOLOR_DYELLOW 0x6
  70. #define CONCOLOR_LGREY 0x7
  71. #define CONCOLOR_LGREEN 0x8
  72. #define CONCOLOR_BLUE 0x9
  73. #define CONCOLOR_GREEN 0xA
  74. #define CONCOLOR_CYAN 0xB
  75. #define CONCOLOR_RED 0xC
  76. #define CONCOLOR_MAGENTA 0xD
  77. #define CONCOLOR_YELLOW 0xE
  78. #define CONCOLOR_TXTDEF_WHITE 0xF
  79. extern bool g_noConColors; // Windows' console text coloring
  80. extern void ConColor(const short c_text_color, const short c_background_color);
  81. // <-- SILENCER
  82. // Should be in hlassert.h, but well so what
  83. extern void hlassume(bool exp, assume_msgs msgid);
  84. #endif // Should be in hlassert.h, but well so what LOG_H__