File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,8 +161,17 @@ class Logger {
161161 // File sink setup
162162 if (!config.logFilePath .empty ()) {
163163 try {
164- // Suppress spdlog file rotation errors by setting environment variable
165- setenv (" SPDLOG_LEVEL" , " warn" , 1 );
164+ // Suppress spdlog file rotation errors by setting environment variables
165+ setenv (" SPDLOG_LEVEL" , " error" , 1 ); // Only show errors, not warnings
166+ setenv (" SPDLOG_ERROR_LEVEL" , " critical" , 1 ); // Only show critical errors
167+
168+ // Set global spdlog error handler to suppress file rotation warnings
169+ spdlog::set_error_handler ([](const std::string& msg) {
170+ // Only log critical errors, ignore file rotation warnings
171+ if (msg.find (" rotating_file_sink" ) == std::string::npos) {
172+ std::cerr << " spdlog error: " << msg << std::endl;
173+ }
174+ });
166175
167176 // Ensure directory exists and is writable
168177 std::filesystem::path logPath (config.logFilePath );
You can’t perform that action at this time.
0 commit comments