mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
6 years ago
|
#ifndef _WIN32
|
||
5 years ago
|
#include <util/logging/logger_syslog.hpp>
|
||
|
|
||
|
#include <util/logging/logger_internal.hpp>
|
||
|
|
||
6 years ago
|
#include <syslog.h>
|
||
|
namespace llarp
|
||
|
{
|
||
|
void
|
||
|
SysLogStream::PreLog(std::stringstream& ss, LogLevel lvl, const char* fname,
|
||
5 years ago
|
int lineno, const std::string& nodename) const
|
||
6 years ago
|
{
|
||
5 years ago
|
ss << "[" << LogLevelToString(lvl) << "] ";
|
||
|
ss << "[" << nodename << "]"
|
||
|
<< "(" << thread_id_string() << ") " << log_timestamp() << " " << fname
|
||
6 years ago
|
<< ":" << lineno << "\t";
|
||
|
}
|
||
|
|
||
|
void
|
||
6 years ago
|
SysLogStream::Print(LogLevel lvl, const char*, const std::string& msg)
|
||
6 years ago
|
{
|
||
|
switch(lvl)
|
||
|
{
|
||
|
case eLogNone:
|
||
|
return;
|
||
|
case eLogDebug:
|
||
|
::syslog(LOG_DEBUG, "%s", msg.c_str());
|
||
|
return;
|
||
|
case eLogInfo:
|
||
|
::syslog(LOG_INFO, "%s", msg.c_str());
|
||
|
return;
|
||
|
case eLogWarn:
|
||
|
::syslog(LOG_WARNING, "%s", msg.c_str());
|
||
|
return;
|
||
|
case eLogError:
|
||
|
::syslog(LOG_ERR, "%s", msg.c_str());
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void
|
||
|
SysLogStream::PostLog(std::stringstream&) const
|
||
|
{
|
||
|
}
|
||
|
} // namespace llarp
|
||
|
#endif
|