Moonlight-XboxOG latest
Moonlight Xbox OG is a port of the Moonlight Game Streaming client to the original Xbox console.
log_file.h File Reference

Declares log file lifecycle helpers. More...

#include <cstddef>
#include <string>
#include <vector>
#include "src/logging/logger.h"
Include dependency graph for log_file.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  logging::LoadLogFileResult
 Result of loading the persisted log file for the shell viewer. More...
 
class  logging::RuntimeLogFileSink
 Small helper that targets one persisted runtime log file. More...
 

Functions

bool logging::append_log_file_entry (const LogEntry &entry, const std::string &filePath=default_log_file_path(), std::string *errorMessage=nullptr)
 Append one formatted log entry to the persisted log file.
 
std::string logging::default_log_file_path ()
 Return the default path used for persisted log output.
 
LoadLogFileResult logging::load_log_file (const std::string &filePath=default_log_file_path(), std::size_t maxLines=64U)
 Load recent lines from the persisted log file.
 
bool logging::reset_log_file (const std::string &filePath=default_log_file_path(), std::string *errorMessage=nullptr)
 Truncate or recreate the persisted log file.
 

Detailed Description

Declares log file lifecycle helpers.

Function Documentation

◆ append_log_file_entry()

bool logging::append_log_file_entry ( const LogEntry & entry,
const std::string & filePath = default_log_file_path(),
std::string * errorMessage = nullptr )

Append one formatted log entry to the persisted log file.

Parameters
entryStructured log entry to append.
filePathTarget log file path.
errorMessageOptional output for I/O failures.
Returns
true when the entry was written successfully.

◆ default_log_file_path()

std::string logging::default_log_file_path ( )

Return the default path used for persisted log output.

Returns
Default log file path.

◆ load_log_file()

LoadLogFileResult logging::load_log_file ( const std::string & filePath = default_log_file_path(),
std::size_t maxLines = 64U )

Load recent lines from the persisted log file.

Parameters
filePathTarget log file path.
maxLinesMaximum number of trailing lines to retain.
Returns
Loaded log file contents and any error details.

◆ reset_log_file()

bool logging::reset_log_file ( const std::string & filePath = default_log_file_path(),
std::string * errorMessage = nullptr )

Truncate or recreate the persisted log file.

Parameters
filePathPath to reset.
errorMessageOptional output for I/O failures.
Returns
true when the file was reset successfully.