Log.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef LOG_H_
  17. #define LOG_H_
  18. #include <string.h>
  19. #include "../WorldServer/client.h"
  20. #define LOG_BUFFER_SIZE 4096
  21. #define LOG_CATEGORY(category) LOG_ ##category ,
  22. enum LogCategory
  23. {
  24. #include "LogTypes.h"
  25. NUMBER_OF_LOG_CATEGORIES
  26. };
  27. #define LOG_TYPE(category, type, level, color, enabled, logfile, console, client, str) category##__##type ,
  28. enum LogType
  29. {
  30. #include "LogTypes.h"
  31. NUMBER_OF_LOG_TYPES
  32. };
  33. extern const char* log_category_names[NUMBER_OF_LOG_CATEGORIES];
  34. struct LogTypeStatus
  35. {
  36. int8 level;
  37. int color;
  38. bool enabled;
  39. bool logfile;
  40. bool console;
  41. bool client;
  42. LogCategory category;
  43. const char *name;
  44. const char *display_name;
  45. };
  46. extern LogTypeStatus* log_type_info;
  47. void LogStart();
  48. void LogStop();
  49. int8 GetLoggerLevel(LogType type);
  50. void LogWrite(LogType type, int8 log_level, const char *cat_text, const char *fmt, ...);
  51. #ifdef PARSER
  52. void ColorizeLog(int color, char *date, const char *display_name, const char *category, string buffer);
  53. #endif
  54. bool LogParseConfigs();
  55. #endif