2 * Copyright (C) 2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "PosixInterfaceForCLog.h"
11 #include "ServiceBroker.h"
12 #include "application/AppParams.h"
14 #include <spdlog/sinks/dist_sink.h>
15 #include <spdlog/sinks/stdout_color_sinks.h>
17 #if !defined(TARGET_ANDROID) && !defined(TARGET_DARWIN)
18 std::unique_ptr
<IPlatformLog
> IPlatformLog::CreatePlatformLog()
20 return std::make_unique
<CPosixInterfaceForCLog
>();
24 void CPosixInterfaceForCLog::AddSinks(
25 std::shared_ptr
<spdlog::sinks::dist_sink
<std::mutex
>> distributionSink
) const
27 if (CServiceBroker::GetAppParams()->GetLogTarget() == "console")
28 distributionSink
->add_sink(std::make_shared
<spdlog::sinks::stdout_color_sink_st
>());