/*
 * Copyright 2015 - 2025 gary@drinkingtea.net
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */

#include <ox/std/trace.hpp>

namespace ox::trace {

static class: public Logger {
	public:
		ox::Error send(const TraceMsg&) noexcept final {
			return {};
		}
		ox::Error sendInit(const InitTraceMsg&) noexcept final {
			return {};
		}
} defaultLogger;
static Logger *logger = &defaultLogger;

void init() {
	oxTraceInitHook();
}

void init(Logger *logger) {
	oxTraceInitHook();
	setLogger(logger);
}

void setLogger(Logger *logger) noexcept {
	trace::logger = logger;
}

void send(const TraceMsg &msg) noexcept {
	std::ignore = logger->send(msg);
}

}
