Renamed traits to console globals

This commit is contained in:
gabime
2018-07-07 13:38:15 +03:00
parent 39c6eb752a
commit bde4c7149f
3 changed files with 15 additions and 14 deletions

View File

@@ -0,0 +1,58 @@
#pragma once
//
// Copyright(c) 2018 Gabi Melman.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
//
#include "stdio.h"
namespace spdlog {
namespace details {
struct console_stdout_stream
{
static FILE *stream()
{
return stdout;
}
#ifdef _WIN32
static HANDLE handle()
{
return ::GetStdHandle(STD_OUTPUT_HANDLE);
}
#endif
};
struct console_stderr_stream
{
static FILE *stream()
{
return stderr;
}
#ifdef _WIN32
static HANDLE handle()
{
return ::GetStdHandle(STD_ERROR_HANDLE);
}
#endif
};
struct console_global_mutex
{
using mutex_t = std::mutex;
static mutex_t &console_mutex()
{
static mutex_t mutex;
return mutex;
}
};
struct console_global_nullmutex
{
using mutex_t = null_mutex;
static mutex_t &console_mutex()
{
static mutex_t mutex;
return mutex;
}
};
} // namespace details
} // namespace spdlog