IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 7ac1f055 authored by ralfulrich's avatar ralfulrich
Browse files

added logging...

parent 6d05464f
No related branches found
No related tags found
No related merge requests found
add_subdirectory (Units)
add_subdirectory (Geometry)
add_subdirectory (Logging)
add_executable (geometry_example geometry_example.cc)
target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
install (TARGETS geometry_example DESTINATION bin)
add_executable (logger_example logger_example.cc)
target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
install (TARGETS logger_example DESTINATION bin)
#include <Logging/Logger.h>
#include <string>
#include <iostream>
#include <boost/format.hpp>
using namespace std;
int
main()
{
{
ofstream logfile("another.log");
typedef Sink<ofstream, StdBuffer> SinkFile;
SinkFile sink(logfile, StdBuffer(10000));
logger<SinkFile, messageconst> info("\033[32m", "info", sink);
logger<SinkFile, messageconst> err("\033[31m", "error", sink);
//logger<ostream,messageconst,StdBuffer> info(std::cout, StdBuffer(10000));
/*
Logging& logs = Logging::GetInstance();
logs.AddLogger<>("info", info);
auto& log_1 = logs.GetLogger("info"); // no so useful, since type of log_1 is std::any
*/
for (int i=0; i<100000; ++i) {
LOG(info, "irgendwas"," ", string("and more")," ", boost::format("error: %i message: %s. done."), i, "stupido");
LOG(err, "Fehler");
}
}
{
NoSink off;
logger<NoSink, MessageOff> info("", "", off);
for (int i=0; i<100000; ++i) {
LOG(info, "irgendwas", string("and more"), boost::format("error: %i message: %s. done."), i, "stupido", "a-number:", 8.99, "ENDE" );
}
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment