2021-06-30 11:21:17 +00:00
|
|
|
#pragma once
|
2021-08-23 15:48:55 +00:00
|
|
|
|
2021-08-25 23:28:58 +00:00
|
|
|
#include <llarp/util/logging/logger.hpp>
|
2021-08-23 15:48:55 +00:00
|
|
|
#include <llarp/util/logging/logstream.hpp>
|
2021-06-30 11:21:17 +00:00
|
|
|
|
2021-08-25 23:28:58 +00:00
|
|
|
namespace llarp::apple
|
2021-06-30 11:21:17 +00:00
|
|
|
{
|
|
|
|
struct NSLogStream : public ILogStream
|
|
|
|
{
|
2021-08-25 23:28:58 +00:00
|
|
|
using ns_logger_callback = void (*)(const char* log_this);
|
|
|
|
|
|
|
|
NSLogStream(ns_logger_callback logger) : ns_logger{logger}
|
|
|
|
{}
|
|
|
|
|
2021-06-30 11:21:17 +00:00
|
|
|
void
|
|
|
|
PreLog(
|
|
|
|
std::stringstream& s,
|
|
|
|
LogLevel lvl,
|
|
|
|
const char* fname,
|
|
|
|
int lineno,
|
|
|
|
const std::string& nodename) const override;
|
|
|
|
|
|
|
|
void
|
|
|
|
Print(LogLevel lvl, const char* tag, const std::string& msg) override;
|
|
|
|
|
|
|
|
void
|
2021-08-25 23:28:58 +00:00
|
|
|
PostLog(std::stringstream& ss) const override
|
|
|
|
{}
|
2021-06-30 11:21:17 +00:00
|
|
|
|
2021-08-25 23:28:58 +00:00
|
|
|
void
|
2021-06-30 11:21:17 +00:00
|
|
|
ImmediateFlush() override
|
|
|
|
{}
|
|
|
|
|
|
|
|
void Tick(llarp_time_t) override
|
|
|
|
{}
|
2021-08-25 23:28:58 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
ns_logger_callback ns_logger;
|
2021-06-30 11:21:17 +00:00
|
|
|
};
|
2021-08-25 23:28:58 +00:00
|
|
|
} // namespace llarp::apple
|