blob: 2b8ec6d7c220e7d4f540b50530f9b2bcc49b0344 [file] [log] [blame]
Austin Schuh812d0d12021-11-04 20:16:48 -07001// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#include "wpi/Logger.h"
6
7using namespace wpi;
8
9void Logger::DoLog(unsigned int level, const char* file, unsigned int line,
10 const char* msg) {
11 if (!m_func || level < m_min_level) {
12 return;
13 }
14 m_func(level, file, line, msg);
15}
16
17void Logger::LogV(unsigned int level, const char* file, unsigned int line,
18 fmt::string_view format, fmt::format_args args) {
19 if (!m_func || level < m_min_level) {
20 return;
21 }
22 fmt::memory_buffer out;
23 fmt::vformat_to(fmt::appender{out}, format, args);
24 out.push_back('\0');
25 m_func(level, file, line, out.data());
26}