150 .
name =
"infologger",
152 auto infoLoggerMode = options.GetPropertyAsString(
"infologger-mode");
153 auto infoLoggerSeverity = options.GetPropertyAsString(
"infologger-severity");
154 if (infoLoggerSeverity.empty() ==
false && options.GetPropertyAsString(
"infologger-mode") ==
"") {
155 LOGP(info,
"Using O2_INFOLOGGER_MODE=infoLoggerD since infologger-severity is set");
156 infoLoggerMode =
"infoLoggerD";
158 if (infoLoggerMode !=
"") {
159 setenv(
"O2_INFOLOGGER_MODE", infoLoggerMode.c_str(), 1);
161 char const* infoLoggerEnv = getenv(
"O2_INFOLOGGER_MODE");
162 if (infoLoggerEnv ==
nullptr || strcmp(infoLoggerEnv,
"none") == 0) {
165 .kind = ServiceKind::Serial,
166 .name =
"infologger"};
168 InfoLogger* infoLoggerService =
nullptr;
170 infoLoggerService =
new InfoLogger;
172 LOGP(error,
"Unable to initialise InfoLogger with O2_INFOLOGGER_MODE={}.", infoLoggerMode);
175 .kind = ServiceKind::Serial,
176 .name =
"infologger"};
178 auto infoLoggerContext = &services.
get<InfoLoggerContext>();
181 auto truncate = [](std::string in) -> std::string {
182 if (in.size() < 32) {
186 memcpy(
name, in.data(), 10);
190 memcpy(
name + 13, in.data() + in.size() - 18, 18);
195 infoLoggerContext->setField(InfoLoggerContext::FieldName::System, std::string(
"DPL"));
196 infoLoggerService->setContext(*infoLoggerContext);
198 if (infoLoggerSeverity !=
"") {
199 fair::Logger::AddCustomSink(
"infologger", infoLoggerSeverity,
createInfoLoggerSinkHelper(infoLoggerService, infoLoggerContext));
202 .instance = infoLoggerService,
203 .kind = ServiceKind::Serial,
204 .name =
"infologger"};
207 .kind = ServiceKind::Serial};