-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathLogger.h
32 lines (29 loc) · 983 Bytes
/
Logger.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ------------------------------------------------------------
// Copyright(c) 2018-2022 Jesse Yurkovich
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
// See the LICENSE file in the repo root for full license information.
// ------------------------------------------------------------
#pragma once
#include <iostream>
#include "StringFormatter.h"
namespace Logger
{
template <typename... Args>
static void Write(std::basic_string_view<char> format, Args &&... args)
{
if constexpr (sizeof...(args) > 0)
{
std::cout << fx::common::StringFormatter::Format(format, std::forward<Args>(args)...);
}
else
{
std::cout << format;
}
}
template <typename... Args>
static void WriteLine(std::basic_string_view<char> format, Args &&... args)
{
Logger::Write(format, std::forward<Args>(args)...);
std::cout << std::endl;
}
} // namespace Logger