1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
13 #include <anna/core/tracing/Logger.hpp>
14 #include <anna/core/tracing/TraceLogger.hpp>
15 #include <anna/core/DataBlock.hpp>
19 void TraceLogger::initialize(const char* ident)
21 openlog(ident, LOG_PID | LOG_CONS | LOG_ODELAY | LOG_NOWAIT, LOG_LOCAL0);
24 void TraceLogger::do_write(int level, const char* message, ...)
31 DataBlock& dataBlock(getDataBlock());
32 const char* data(dataBlock.getData());
33 size = dataBlock.getMaxSize();
36 va_start(ap, message);
37 nbytes = vsnprintf(const_cast <char*>(data), size, message, ap);
41 dataBlock.allocate(nbytes + 1);
42 data = dataBlock.getData();
43 size = dataBlock.getMaxSize();
50 // void syslog(int priority, const char *format, ...);
51 syslog(level, "%s", data);