Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
log_sinks.h
Go to the documentation of this file.
1// log_sinks.h — ログの出力先(コンソール・デバッガ・ファイル)を作る。Windows 専用。
2//
3// Logger(core/log.h)は作られたときにコンソールとデバッガのシンクを自分で登録する。
4// ファイルは置き場所をコマンドラインで変えられるように、main が OpenLogFile() で後から足す。
5#pragma once
6
7#include <expected>
8#include <filesystem>
9#include <memory>
10#include <string>
11
12#include "core/aliases.h"
13#include "core/log.h"
14
15namespace bicameral {
16
17 // 標準出力へ UTF-8 で書く。コンソールなら色を付け、Warning 以上には呼んだ場所を付ける
18 std::unique_ptr<LogSink> CreateConsoleSink();
19
20 // OutputDebugString(VS の出力ウィンドウ)へ書く。Warning 以上は "path(line): ..." の形で、ダブルクリックで飛べる
21 std::unique_ptr<LogSink> CreateDebuggerSink();
22
23 // directory に bicameral-YYYYMMDD-HHMMSS.log を作ってファイルのシンクを logger に足す。成功ならファイルのパス。
24 // 古いログは新しい方から MAX_LOG_FILES 個だけ残して消す
25 std::expected<fs::path, std::string> OpenLogFile(Logger& logger, const fs::path& directory);
26
27 // 既定のログの置き場所: exe の横の logs/(ADR-0006。PC 固有のパスを埋め込まない)
28 fs::path DefaultLogDirectory();
29
30} // namespace bicameral
std::expected< fs::path, std::string > OpenLogFile(Logger &logger, const fs::path &directory)
fs::path DefaultLogDirectory()
std::unique_ptr< LogSink > CreateConsoleSink()
std::unique_ptr< LogSink > CreateDebuggerSink()