mirror of https://github.com/gabime/spdlog.git
Refactored filename_t and file_event_handlers
parent
65f8b0a16e
commit
5401731160
@ -1,8 +1,19 @@
|
|||||||
//
|
#pragma once
|
||||||
// Created by gabi on 12/5/24.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef FILE_EVENT_HANDLERS_H
|
#include <functional>
|
||||||
#define FILE_EVENT_HANDLERS_H
|
#include "./filename_t.h"
|
||||||
|
|
||||||
#endif //FILE_EVENT_HANDLERS_H
|
namespace spdlog {
|
||||||
|
struct file_event_handlers {
|
||||||
|
file_event_handlers()
|
||||||
|
: before_open(nullptr),
|
||||||
|
after_open(nullptr),
|
||||||
|
before_close(nullptr),
|
||||||
|
after_close(nullptr) {}
|
||||||
|
|
||||||
|
std::function<void(const filename_t &filename)> before_open;
|
||||||
|
std::function<void(const filename_t &filename, std::FILE *file_stream)> after_open;
|
||||||
|
std::function<void(const filename_t &filename, std::FILE *file_stream)> before_close;
|
||||||
|
std::function<void(const filename_t &filename)> after_close;
|
||||||
|
};
|
||||||
|
} // namespace spdlog
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
||||||
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// In windows, add L prefix for filename literals (e.g. L"filename.txt")
|
||||||
|
#define SPDLOG_FILENAME_T_INNER(s) L##s
|
||||||
|
#define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s)
|
||||||
|
#else
|
||||||
|
#define SPDLOG_FILENAME_T(s) s
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace spdlog {
|
||||||
|
using filename_t = std::filesystem::path;
|
||||||
|
} // namespace spdlog
|
Loading…
Reference in New Issue