2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Helge Norberg, helge.norberg@svt.se
22 #include "graph_to_log_sink.h"
26 #include <tbb/spin_mutex.h>
28 namespace caspar { namespace diagnostics {
30 class graph_to_log_sink : public spi::graph_sink
32 tbb::spin_mutex mutex_;
35 void activate() override
39 void set_text(const std::wstring& value) override
41 tbb::spin_mutex::scoped_lock lock(mutex_);
45 void set_value(const std::string& name, double value) override
49 void set_color(const std::string& name, int color) override
53 void set_tag(tag_severity severity, const std::string& name) override
55 tbb::spin_mutex::scoped_lock lock(mutex_);
59 case tag_severity::INFO:
60 CASPAR_LOG(trace) << L"[diagnostics] [" << text_ << L"] " << name;
62 case tag_severity::WARNING:
63 CASPAR_LOG(debug) << L"[diagnostics] [" << text_ << L"] " << name;
68 void auto_reset() override
73 void register_graph_to_log_sink()
75 spi::register_sink_factory([] { return spl::make_shared<graph_to_log_sink>(); });