#define PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS // Faster compilation
#include <pantheios/pantheios.hpp>
#include <pantheios/inserters/args.hpp>
#include <pantheios/frontends/fe.simple.h>
#include <pantheios/backends/be.N.h>
#include <platformstl/platformstl.h>
#if defined(PLATFORMSTL_OS_IS_UNIX)
# include <pantheios/backends/bec.fprintf.h>
# include <pantheios/backends/bec.syslog.h>
#elif defined(PLATFORMSTL_OS_IS_WINDOWS)
# include <pantheios/backends/bec.WindowsConsole.h>
# include <pantheios/backends/bec.WindowsSyslog.h>
#else
# error Platform not discriminated
#endif
#include <stlsoft/stlsoft.h>
#include <exception>
#include <stdio.h>
#include <stdlib.h>
extern "C" const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("example.cpp.backends.mx.2");
#define PSTR(x) PANTHEIOS_LITERAL_STRING(x)
enum
{
beid_Console = 1,
beid_Syslog = 2
};
pan_be_N_t PAN_BE_N_BACKEND_LIST[] =
{
#if defined(PLATFORMSTL_OS_IS_UNIX)
PANTHEIOS_BE_N_STDFORM_ENTRY(beid_Console, pantheios_be_fprintf, PANTHEIOS_BE_N_F_IGNORE_NONMATCHED_CUSTOM28_ID),
PANTHEIOS_BE_N_STDFORM_ENTRY(beid_Syslog, pantheios_be_syslog, PANTHEIOS_BE_N_F_ID_MUST_MATCH_CUSTOM28),
#elif defined(PLATFORMSTL_OS_IS_WINDOWS)
PANTHEIOS_BE_N_STDFORM_ENTRY(beid_Console, pantheios_be_WindowsConsole, PANTHEIOS_BE_N_F_IGNORE_NONMATCHED_CUSTOM28_ID),
PANTHEIOS_BE_N_STDFORM_ENTRY(beid_Syslog, pantheios_be_WindowsSyslog, PANTHEIOS_BE_N_F_ID_MUST_MATCH_CUSTOM28),
#else
# error Platform not discriminated
#endif
PANTHEIOS_BE_N_TERMINATOR_ENTRY
};
static int main_(int argc, char** argv)
{
#ifndef PANTHEIOS_USE_WIDE_STRINGS
pantheios::log_NOTICE(PSTR("main("), pantheios::args(argc, argv), PSTR(")"));
#else
STLSOFT_SUPPRESS_UNUSED(argc); STLSOFT_SUPPRESS_UNUSED(argv);
#endif
pantheios::log(pantheios::notice(beid_Syslog), PSTR("Isn't targeted multiplexing great?!"));
return EXIT_SUCCESS;
}
int main(int argc, char** argv)
{
try
{
return main_(argc, argv);
}
catch(std::bad_alloc&)
{
pantheios::log(pantheios::alert, PSTR("out of memory"));
}
catch(std::exception& x)
{
pantheios::log_CRITICAL(PSTR("Exception: "), x);
}
catch(...)
{
pantheios::logputs(pantheios::emergency, PSTR("Unhandled unknown error"));
}
return EXIT_FAILURE;
}