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.
39 lines
897 B
Plaintext
39 lines
897 B
Plaintext
3 years ago
|
#ifdef __APPLE__
|
||
|
#include "apple_logger.hpp"
|
||
|
#include "logger_internal.hpp"
|
||
|
|
||
|
#include <Foundation/Foundation.h>
|
||
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
void
|
||
|
NSLogStream::PreLog(
|
||
|
std::stringstream& ss,
|
||
|
LogLevel lvl,
|
||
|
const char* fname,
|
||
|
int lineno,
|
||
|
const std::string& nodename) const
|
||
|
{
|
||
|
ss << "[" << LogLevelToString(lvl) << "] ";
|
||
|
ss << "[" << nodename << "]"
|
||
|
<< "(" << thread_id_string() << ") " << log_timestamp() << " " << fname << ":" << lineno
|
||
|
<< "\t";
|
||
|
}
|
||
|
|
||
|
void
|
||
|
NSLogStream::Print(LogLevel, const char*, const std::string& msg)
|
||
|
{
|
||
|
const char* msg_ptr = msg.c_str();
|
||
|
const char* msg_fmt = "%s";
|
||
|
NSString* fmt = [[NSString alloc] initWithUTF8String:msg_ptr];
|
||
|
NSString* str = [[NSString alloc] initWithUTF8String:msg_fmt];
|
||
|
NSLog(fmt, str);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
NSLogStream::PostLog(std::stringstream&) const
|
||
|
{}
|
||
|
|
||
|
} // namespace llarp
|
||
|
#endif
|