You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.3 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: test/scratch/test.scratch.bec.WindowsConsoleCallback/test.scratch.bec.WindowsConsoleCallback.cpp
  3. *
  4. * Purpose: Implementation file for the test.scratch.bec.WindowsConsoleCallback project.
  5. *
  6. * Created: 31st July 2007
  7. * Updated: 6th August 2012
  8. *
  9. * Status: Wizard-generated
  10. *
  11. * License: (Licensed under the Synesis Software Open License)
  12. *
  13. * Copyright (c) 2007-2012, Synesis Software Pty Ltd.
  14. * All rights reserved.
  15. *
  16. * www: http://www.synesis.com.au/software
  17. *
  18. * ////////////////////////////////////////////////////////////////////// */
  19. #define PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS
  20. /* Pantheios Header Files */
  21. #include <pantheios/pantheios.hpp>
  22. #include <pantheios/backends/bec.WindowsConsole.h>
  23. /* STLSoft Header Files */
  24. #include <stlsoft/stlsoft.h>
  25. #include <winstl/winstl.h>
  26. #include <winstl/error/error_desc.hpp>
  27. /* Standard C++ Header Files */
  28. #include <exception>
  29. /* Standard C Header Files */
  30. #include <stdlib.h>
  31. #if defined(_MSC_VER) && \
  32. defined(_DEBUG)
  33. # include <crtdbg.h>
  34. #endif /* _MSC_VER) && _DEBUG */
  35. /* /////////////////////////////////////////////////////////////////////////
  36. * Globals
  37. */
  38. PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.scratch.bec.WindowsConsoleCallback");
  39. /* ////////////////////////////////////////////////////////////////////// */
  40. PANTHEIOS_CALL(void) pantheios_be_WindowsConsole_getAppInit(int backEndId, pan_be_WindowsConsole_init_t *init) /* throw() */
  41. {
  42. init->flags |= PANTHEIOS_BE_INIT_F_NO_PROCESS_ID;
  43. init->flags |= PANTHEIOS_BE_INIT_F_NO_DATETIME;
  44. init->flags |= PANTHEIOS_BE_INIT_F_NO_SEVERITY;
  45. init->flags |= PANTHEIOS_BE_INIT_F_USE_SYSTEM_TIME;
  46. // init->flags |= PANTHEIOS_BE_WINDOWSCONSOLE_F_NO_COLOURS;
  47. }
  48. static int main_(int /* argc */, char** /*argv*/)
  49. {
  50. pantheios::log_DEBUG("debug");
  51. pantheios::log_INFORMATIONAL("info");
  52. pantheios::log_NOTICE("notice");
  53. pantheios::log_WARNING("warn");
  54. pantheios::log_ERROR("error");
  55. pantheios::log_CRITICAL("critical");
  56. pantheios::log_ALERT("alert");
  57. pantheios::log_EMERGENCY("emergency");
  58. /* . */
  59. return EXIT_SUCCESS;
  60. }
  61. int main(int argc, char** argv)
  62. {
  63. int res;
  64. #if defined(_MSC_VER) && \
  65. defined(_DEBUG)
  66. _CrtMemState memState;
  67. #endif /* _MSC_VER && _MSC_VER */
  68. #if defined(_MSC_VER) && \
  69. defined(_DEBUG)
  70. _CrtMemCheckpoint(&memState);
  71. #endif /* _MSC_VER && _MSC_VER */
  72. #if 0
  73. { for(size_t i = 0; i < 0xffffffff; ++i){} }
  74. #endif /* 0 */
  75. try
  76. {
  77. #if defined(_DEBUG) || \
  78. defined(__SYNSOFT_DBS_DEBUG)
  79. #endif /* debug */
  80. res = main_(argc, argv);
  81. }
  82. catch(std::exception &x)
  83. {
  84. pantheios::log_ALERT("Unexpected general error: ", x, ". Application terminating");
  85. res = EXIT_FAILURE;
  86. }
  87. catch(...)
  88. {
  89. pantheios::logputs(pantheios::emergency, "Unhandled unknown error");
  90. res = EXIT_FAILURE;
  91. }
  92. #if defined(_MSC_VER) && \
  93. defined(_DEBUG)
  94. _CrtMemDumpAllObjectsSince(&memState);
  95. #endif /* _MSC_VER) && _DEBUG */
  96. return res;
  97. }
  98. /* ////////////////////////////////////////////////////////////////////// */