00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <pantheios/pantheios.hpp>
00027 #include <pantheios/frontend.h>
00028
00029
00030 #include <stlsoft/memory/auto_buffer.hpp>
00031
00032
00033 #include <exception>
00034 #include <string>
00035 #include <stdlib.h>
00036 #include <string.h>
00037
00038 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00039 # if defined(STLSOFT_COMPILER_IS_MSVC)
00040 # pragma warning(disable : 4702)
00041 # endif
00042 #endif
00043
00044
00045
00046 namespace
00047 {
00048
00049
00050
00051 static int s_severityCeiling = pantheios::notice;
00052
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 int main(int argc, char **argv)
00064 {
00065 if(argc > 1)
00066 {
00067 s_severityCeiling = atoi(argv[1]);
00068 }
00069
00070 try
00071 {
00072 pantheios::log_DEBUG("debug statement");
00073 pantheios::log_INFORMATIONAL("informational statement");
00074 pantheios::log_NOTICE("notice statement");
00075 pantheios::log_WARNING("warning statement");
00076 pantheios::log_ERROR("error statement");
00077 pantheios::log_CRITICAL("critical statement");
00078 pantheios::log_ALERT("alert statement");
00079 pantheios::log_EMERGENCY("emergency statement");
00080
00081
00082 return EXIT_SUCCESS;
00083 }
00084 catch(std::bad_alloc &)
00085 {
00086 pantheios::log_CRITICAL("out of memory");
00087 }
00088 catch(std::exception &x)
00089 {
00090 pantheios::log_ALERT("Exception: ", x);
00091 }
00092 catch(...)
00093 {
00094 pantheios::puts(pantheios::emergency, "Unexpected unknown error");
00095 }
00096
00097 return EXIT_FAILURE;
00098 }
00099
00100
00101
00102 PANTHEIOS_CALL(int) pantheios_fe_init( void *
00103 , void **ptoken)
00104 {
00105 *ptoken = NULL;
00106
00107 return 0;
00108 }
00109
00110 PANTHEIOS_CALL(void) pantheios_fe_uninit(void * )
00111 {}
00112
00113 PANTHEIOS_CALL(char const*) pantheios_fe_getProcessIdentity(void * )
00114 {
00115 return "example_cpp_custom_fe";
00116 }
00117
00118 PANTHEIOS_CALL(int) pantheios_fe_isSeverityLogged( void *
00119 , int severity
00120 , int )
00121 {
00122 return severity <= s_severityCeiling;
00123 }
00124
00125