showmsg.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef SHOWMSG_HPP
  4. #define SHOWMSG_HPP
  5. #include "../../3rdparty/libconfig/libconfig.h"
  6. // for help with the console colors look here:
  7. // http://www.edoceo.com/liberum/?doc=printf-with-color
  8. // some code explanation (used here):
  9. // \033[2J : clear screen and go up/left (0, 0 position)
  10. // \033[K : clear line from actual position to end of the line
  11. // \033[0m : reset color parameter
  12. // \033[1m : use bold for font
  13. #define CL_RESET "\033[0m"
  14. #define CL_CLS "\033[2J"
  15. #define CL_CLL "\033[K"
  16. // font settings
  17. #define CL_BOLD "\033[1m"
  18. #define CL_NORM CL_RESET
  19. #define CL_NORMAL CL_RESET
  20. #define CL_NONE CL_RESET
  21. // foreground color and bold font (bright color on windows)
  22. #define CL_WHITE "\033[1;37m"
  23. #define CL_GRAY "\033[1;30m"
  24. #define CL_RED "\033[1;31m"
  25. #define CL_GREEN "\033[1;32m"
  26. #define CL_YELLOW "\033[1;33m"
  27. #define CL_BLUE "\033[1;34m"
  28. #define CL_MAGENTA "\033[1;35m"
  29. #define CL_CYAN "\033[1;36m"
  30. // background color
  31. #define CL_BG_BLACK "\033[40m"
  32. #define CL_BG_RED "\033[41m"
  33. #define CL_BG_GREEN "\033[42m"
  34. #define CL_BG_YELLOW "\033[43m"
  35. #define CL_BG_BLUE "\033[44m"
  36. #define CL_BG_MAGENTA "\033[45m"
  37. #define CL_BG_CYAN "\033[46m"
  38. #define CL_BG_WHITE "\033[47m"
  39. // foreground color and normal font (normal color on windows)
  40. #define CL_LT_BLACK "\033[0;30m"
  41. #define CL_LT_RED "\033[0;31m"
  42. #define CL_LT_GREEN "\033[0;32m"
  43. #define CL_LT_YELLOW "\033[0;33m"
  44. #define CL_LT_BLUE "\033[0;34m"
  45. #define CL_LT_MAGENTA "\033[0;35m"
  46. #define CL_LT_CYAN "\033[0;36m"
  47. #define CL_LT_WHITE "\033[0;37m"
  48. // foreground color and bold font (bright color on windows)
  49. #define CL_BT_BLACK "\033[1;30m"
  50. #define CL_BT_RED "\033[1;31m"
  51. #define CL_BT_GREEN "\033[1;32m"
  52. #define CL_BT_YELLOW "\033[1;33m"
  53. #define CL_BT_BLUE "\033[1;34m"
  54. #define CL_BT_MAGENTA "\033[1;35m"
  55. #define CL_BT_CYAN "\033[1;36m"
  56. #define CL_BT_WHITE "\033[1;37m"
  57. #define CL_WTBL "\033[37;44m" // white on blue
  58. #define CL_XXBL "\033[0;44m" // default on blue
  59. #define CL_PASS "\033[0;32;42m" // green on green
  60. #define CL_SPACE " " // space aquivalent of the print messages
  61. extern int stdout_with_ansisequence; //If the color ansi sequences are to be used. [flaviojs]
  62. extern int msg_silent; //Specifies how silent the console is. [Skotlex]
  63. extern int console_msg_log; //Specifies what error messages to log. [Ind]
  64. extern char console_log_filepath[32]; ///< Filepath to save console_msg_log. [Cydh]
  65. extern char timestamp_format[20]; //For displaying Timestamps [Skotlex]
  66. enum msg_type {
  67. MSG_NONE,
  68. MSG_STATUS,
  69. MSG_SQL,
  70. MSG_INFORMATION,
  71. MSG_NOTICE,
  72. MSG_WARNING,
  73. MSG_DEBUG,
  74. MSG_ERROR,
  75. MSG_FATALERROR
  76. };
  77. extern void ClearScreen(void);
  78. extern int _vShowMessage(enum msg_type flag, const char *string, va_list ap);
  79. extern void ShowMessage(const char *, ...);
  80. extern void ShowStatus(const char *, ...);
  81. extern void ShowSQL(const char *, ...);
  82. extern void ShowInfo(const char *, ...);
  83. extern void ShowNotice(const char *, ...);
  84. extern void ShowWarning(const char *, ...);
  85. extern void ShowDebug(const char *, ...);
  86. extern void ShowError(const char *, ...);
  87. extern void ShowFatalError(const char *, ...);
  88. extern void ShowConfigWarning(config_setting_t *config, const char *string, ...);
  89. #endif /* SHOWMSG_HPP */