mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
Adjustments for runner process logging (#8112)
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include "pch.h"
|
||||
#include "framework.h"
|
||||
#include "logger.h"
|
||||
#include "logger_settings.h"
|
||||
#include <map>
|
||||
#include <spdlog/sinks/daily_file_sink.h>
|
||||
#include <spdlog\sinks\stdout_color_sinks-inl.h>
|
||||
@@ -43,7 +42,7 @@ Logger::Logger(std::string loggerName, std::wstring logFilePath, std::wstring_vi
|
||||
auto logLevel = getLogLevel(logSettingsPath);
|
||||
try
|
||||
{
|
||||
auto sink = make_shared<sinks::daily_file_sink_mt>(logFilePath, 0, 0, false, 5);
|
||||
auto sink = make_shared<sinks::daily_file_sink_mt>(logFilePath, 0, 0, false, LogSettings::retention);
|
||||
this->logger = make_shared<spdlog::logger>(loggerName, sink);
|
||||
}
|
||||
catch (...)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <spdlog/spdlog.h>
|
||||
#include "logger_settings.h"
|
||||
|
||||
class Logger
|
||||
{
|
||||
@@ -10,36 +11,42 @@ public:
|
||||
Logger();
|
||||
Logger(std::string loggerName, std::wstring logFilePath, std::wstring_view logSettingsPath);
|
||||
|
||||
// log message should not be localized
|
||||
template<typename FormatString, typename... Args>
|
||||
void trace(const FormatString& fmt, const Args&... args)
|
||||
{
|
||||
this->logger->trace(fmt, args...);
|
||||
}
|
||||
|
||||
// log message should not be localized
|
||||
template<typename FormatString, typename... Args>
|
||||
void debug(const FormatString& fmt, const Args&... args)
|
||||
{
|
||||
this->logger->debug(fmt, args...);
|
||||
}
|
||||
|
||||
// log message should not be localized
|
||||
template<typename FormatString, typename... Args>
|
||||
void info(const FormatString& fmt, const Args&... args)
|
||||
{
|
||||
this->logger->info(fmt, args...);
|
||||
}
|
||||
|
||||
// log message should not be localized
|
||||
template<typename FormatString, typename... Args>
|
||||
void warn(const FormatString& fmt, const Args&... args)
|
||||
{
|
||||
this->logger->warn(fmt, args...);
|
||||
}
|
||||
|
||||
// log message should not be localized
|
||||
template<typename FormatString, typename... Args>
|
||||
void error(const FormatString& fmt, const Args&... args)
|
||||
{
|
||||
this->logger->error(fmt, args...);
|
||||
}
|
||||
|
||||
// log message should not be localized
|
||||
template<typename FormatString, typename... Args>
|
||||
void critical(const FormatString& fmt, const Args&... args)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,11 @@ struct LogSettings
|
||||
// The following strings are not localizable
|
||||
inline const static std::wstring defaultLogLevel = L"warn";
|
||||
inline const static std::wstring logLevelOption = L"logLevel";
|
||||
|
||||
inline const static std::string runnerLoggerName = "runner";
|
||||
inline const static std::wstring runnerLogPath = L"RunnerLogs\\runner-log.txt";
|
||||
inline const static std::string launcherLoggerName = "launcher";
|
||||
inline const static std::wstring launcherLogPath = L"LogsModuleInterface\\launcher-log.txt";
|
||||
inline const static int retention = 30;
|
||||
std::wstring logLevel;
|
||||
LogSettings();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user