do not log to file

This commit is contained in:
pigeatgarlic 2025-01-25 08:28:12 +00:00
parent a3ad81a919
commit 61ec892cf1
5 changed files with 3 additions and 110 deletions

View File

@ -367,58 +367,9 @@ namespace config {
false, // install_steam_drivers
};
stream_t stream {
10s, // ping_timeout
APPS_JSON_PATH,
20, // fecPercentage
1, // channels
ENCRYPTION_MODE_NEVER, // lan_encryption_mode
ENCRYPTION_MODE_OPPORTUNISTIC, // wan_encryption_mode
};
nvhttp_t nvhttp {
"lan", // origin web manager
PRIVATE_KEY_FILE,
CERTIFICATE_FILE,
boost::asio::ip::host_name(), // sunshine_name,
"sunshine_state.json"s, // file_state
{}, // external_ip
{
"352x240"s,
"480x360"s,
"858x480"s,
"1280x720"s,
"1920x1080"s,
"2560x1080"s,
"2560x1440"s,
"3440x1440"s,
"1920x1200"s,
"3840x2160"s,
"3840x1600"s,
}, // supported resolutions
{ 10, 30, 60, 90, 120 }, // supported fps
};
sunshine_t sunshine {
"en", // locale
2, // min_log_level
0, // flags
{}, // User file
{}, // Username
{}, // Password
{}, // Password Salt
platf::appdata().string() + "/sunshine.conf", // config file
{}, // cmd args
47989, // Base port number
"ipv4", // Address family
platf::appdata().string() + "/sunshine.log", // log file
{}, // prep commands
};
} // namespace config

View File

@ -86,39 +86,6 @@ namespace config {
constexpr int ENCRYPTION_MODE_OPPORTUNISTIC = 1; // Use video encryption if available, but stream without it if not supported
constexpr int ENCRYPTION_MODE_MANDATORY = 2; // Always use video encryption and refuse clients that can't encrypt
struct stream_t {
std::chrono::milliseconds ping_timeout;
std::string file_apps;
int fec_percentage;
// max unique instances of video and audio streams
int channels;
// Video encryption settings for LAN and WAN streams
int lan_encryption_mode;
int wan_encryption_mode;
};
struct nvhttp_t {
// Could be any of the following values:
// pc|lan|wan
std::string origin_web_ui_allowed;
std::string pkey;
std::string cert;
std::string sunshine_name;
std::string file_state;
std::string external_ip;
std::vector<std::string> resolutions;
std::vector<int> fps;
};
namespace flag {
enum flag_e : std::size_t {
PIN_STDIN = 0, // Read PIN from stdin instead of http
@ -140,34 +107,11 @@ namespace config {
bool elevated;
};
struct sunshine_t {
std::string locale;
int min_log_level;
std::bitset<flag::FLAG_SIZE> flags;
std::string credentials_file;
std::string username;
std::string password;
std::string salt;
std::string config_file;
struct cmd_t {
std::string name;
int argc;
char **argv;
} cmd;
std::uint16_t port;
std::string address_family;
std::string log_file;
std::vector<prep_cmd_t> prep_cmds;
};
extern video_t video;
extern audio_t audio;
extern stream_t stream;
extern nvhttp_t nvhttp;
extern sunshine_t sunshine;
} // namespace config

View File

@ -63,7 +63,6 @@ namespace logging {
/**
* @brief Initialize the logging system.
* @param min_log_level The minimum log level to output.
* @param log_file The log file to write to.
* @returns A deinit_t object that will deinitialize the logging system when it goes out of scope.
*
* EXAMPLES:
@ -72,7 +71,7 @@ namespace logging {
* ```
*/
[[nodiscard]] std::unique_ptr<deinit_t>
init(int min_log_level, const std::string &log_file) {
init(int min_log_level) {
if (sink) {
// Deinitialize the logging system before reinitializing it. This can probably only ever be hit in tests.
deinit();
@ -84,7 +83,6 @@ namespace logging {
boost::shared_ptr<std::ostream> stream { &std::cout, boost::null_deleter() };
sink->locked_backend()->add_stream(stream);
sink->locked_backend()->add_stream(boost::make_shared<std::ofstream>(log_file));
sink->set_filter(severity >= min_log_level);
sink->set_formatter([](const bl::record_view &view, bl::formatting_ostream &os) {

View File

@ -28,7 +28,7 @@ namespace logging {
void
deinit();
[[nodiscard]] std::unique_ptr<deinit_t>
init(int min_log_level, const std::string &log_file);
init(int min_log_level);
void
setup_av_logging(int min_log_level);
void

View File

@ -152,7 +152,7 @@ main(int argc, char *argv[]) {
mail::man = std::make_shared<safe::mail_raw_t>();
auto log_deinit_guard = logging::init(config::sunshine.min_log_level, config::sunshine.log_file);
auto log_deinit_guard = logging::init(config::sunshine.min_log_level);
if (!log_deinit_guard) {
BOOST_LOG(error) << "Logging failed to initialize"sv;
}