forked from mnisjk/cppWebSockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtil.cpp
32 lines (26 loc) · 827 Bytes
/
Util.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/** --------------------------------------------------------------------------
* Util.cpp
*
* A few very basic utility functions for WebSocketServer
*
* Author : Jason Kruse <[email protected]> or @mnisjk
* Copyright : 2014
* License : BSD (see LICENSE)
* --------------------------------------------------------------------------
**/
#include "Util.h"
#include <cstdio>
constexpr auto LOG_PREFIX = "[cppWebSockets] ";
void Util::log( const std::string& message )
{
const std::string& logMessage = LOG_PREFIX + message;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg, hicpp-vararg)
syslog( LOG_WARNING, "%s", logMessage.c_str( ) );
#ifdef LOG_TO_STDOUT
std::cout << logMessage << std::endl;
#endif
}
void Util::log( const char* message )
{
log( std::string( message ) );
}