少年修仙传客户端基础资源
hch
2024-04-01 d01413b00ef631ac20347716b23818b0b811f65f
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
 
#include <fstream>
 
#include "os/Lumin/File.h"
 
static std::ofstream* out_stream = nullptr;
static std::ofstream* err_stream = nullptr;
static std::ofstream* log_stream = nullptr;
 
std::ostream& Catch::cout()
{
    if (out_stream == nullptr)
    {
        out_stream = new std::ofstream(il2cpp::os::lumin::PathForOutputLog().c_str());
    }
    return *out_stream;
}
 
std::ostream& Catch::cerr()
{
    if (err_stream == nullptr)
    {
        err_stream = new std::ofstream(il2cpp::os::lumin::PathForErrorLog().c_str());
    }
    return *err_stream;
}
 
std::ostream& Catch::clog()
{
    if (log_stream == nullptr)
    {
        log_stream = new std::ofstream(il2cpp::os::lumin::PathForErrorLog().c_str());
    }
    return *log_stream;
}
 
static inline void FlushStreams()
{
    if (out_stream != nullptr)
        out_stream->close();
    if (err_stream != nullptr)
        err_stream->close();
    if (log_stream != nullptr)
        log_stream->close();
}