23#define SYSTEM_LOG ::Logging::Logger()
37 std::lock_guard<std::mutex>
lock(
m_);
50 std::lock_guard<std::mutex>
lock(
m_);
57 auto operator<<(
const T&
v) ->
decltype(std::declval<std::ostringstream&>() <<
v, std::declval<Log&>())
60 std::lock_guard<std::mutex>
lock(
m_);
68 using Manip = std::ostream& (*)(std::ostream&);
71 if (
m ==
static_cast<Manip>(&std::endl))
75 std::lock_guard<std::mutex>
lock(
m_);
81 else if (
m ==
static_cast<Manip>(&std::flush))
88 std::lock_guard<std::mutex>
lock(
m_);
113 std::lock_guard<std::mutex>
lock(
m_);
116 while ((
pos =
s.find(
'\n')) != std::string::npos)
118 std::string
line =
s.substr(0,
pos + 1);
128 std::lock_guard<std::mutex>
lock(
m_);
138 mutable std::mutex
m_;
170 out.reserve(
s.size() + 4);
175 case '\\':
out +=
"\\\\";
break;
176 case '"':
out +=
"\\\"";
break;
177 case '\b':
out +=
"\\b";
break;
178 case '\f':
out +=
"\\f";
break;
179 case '\n':
out +=
"\\n";
break;
180 case '\r':
out +=
"\\r";
break;
181 case '\t':
out +=
"\\t";
break;
182 default:
out +=
c;
break;
192 if (
pos == std::string::npos)
return false;
194 if (
pos == std::string::npos)
return false;
200 if (
pos <= start)
return false;
209 if (
pos == std::string::npos)
return false;
211 if (
pos == std::string::npos)
return false;
216 if (
pos <= start)
return false;
217 try {
out = std::stod(
json.substr(start,
pos - start));
return true; }
218 catch (...) {
return false; }
225 out =
static_cast<int>(
d);
233 if (
pos == std::string::npos)
return false;
235 if (
pos == std::string::npos)
return false;
238 if (
json.compare(
pos, 4,
"true") == 0) {
out =
true;
return true; }
239 if (
json.compare(
pos, 5,
"false") == 0) {
out =
false;
return true; }
ComponentTypeID GetComponentTypeID_Static()
std::ostream &(*)(std::ostream &) Manip
std::ostringstream buffer_
Log & operator<<(Manip m)
void flushCompleteLinesIfAny()
void writeToOutputs(const std::string &s)
auto operator<<(const T &v) -> decltype(std::declval< std::ostringstream & >()<< v, std::declval< Log & >())
bool Init(const std::string &filename="olympe.log")
bool InitLogger(const std::string &filename="olympe.log")
void AppendToLogWindow(const std::string &text)
void LoadOlympeConfig(const char *filename)
static std::string escape_json_string(const std::string &s)
static bool extract_json_double(const std::string &json, const std::string &key, double &out)
std::string ResolveResourcePath(const std::string &relativePath)
static bool extract_json_bool(const std::string &json, const std::string &key, bool &out)
static bool extract_json_int(const std::string &json, const std::string &key, int &out)
static bool extract_json_string(const std::string &json, const std::string &key, std::string &out)