mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Allow resetting the logger back to default (#55)
This commit is contained in:
committed by
Peter Johnson
parent
8f97637b71
commit
c02d34dbf3
@@ -84,3 +84,4 @@ CS_SetCameraWhiteBalanceManual @81
|
||||
CS_SetCameraExposureAuto @82
|
||||
CS_SetCameraExposureHoldCurrent @83
|
||||
CS_SetCameraExposureManual @84
|
||||
CS_SetDefaultLogger @85
|
||||
|
||||
@@ -345,6 +345,7 @@ int CS_NotifierDestroyed(void);
|
||||
typedef void (*CS_LogFunc)(unsigned int level, const char* file,
|
||||
unsigned int line, const char* msg);
|
||||
void CS_SetLogger(CS_LogFunc func, unsigned int min_level);
|
||||
void CS_SetDefaultLogger(unsigned int min_level);
|
||||
|
||||
//
|
||||
// Utility Functions
|
||||
|
||||
@@ -311,6 +311,7 @@ typedef std::function<void(unsigned int level, const char* file,
|
||||
unsigned int line, const char* msg)>
|
||||
LogFunc;
|
||||
void SetLogger(LogFunc func, unsigned int min_level);
|
||||
void SetDefaultLogger(unsigned int min_level);
|
||||
|
||||
//
|
||||
// Utility Functions
|
||||
|
||||
@@ -61,6 +61,8 @@ static void def_log_func(unsigned int level, const char* file,
|
||||
#endif
|
||||
}
|
||||
|
||||
Logger::Logger() { SetLogger(def_log_func); }
|
||||
Logger::Logger() { SetDefaultLogger(); }
|
||||
|
||||
Logger::~Logger() {}
|
||||
|
||||
void Logger::SetDefaultLogger() { SetLogger(def_log_func); }
|
||||
|
||||
@@ -21,6 +21,8 @@ class Logger : public wpi::Logger {
|
||||
}
|
||||
~Logger();
|
||||
|
||||
void SetDefaultLogger();
|
||||
|
||||
private:
|
||||
Logger();
|
||||
|
||||
|
||||
@@ -299,6 +299,10 @@ void CS_SetLogger(CS_LogFunc func, unsigned int min_level) {
|
||||
cs::SetLogger(func, min_level);
|
||||
}
|
||||
|
||||
void CS_SetDefaultLogger(unsigned int min_level) {
|
||||
cs::SetDefaultLogger(min_level);
|
||||
}
|
||||
|
||||
CS_Source* CS_EnumerateSources(int* count, CS_Status* status) {
|
||||
llvm::SmallVector<CS_Source, 32> buf;
|
||||
auto handles = cs::EnumerateSourceHandles(buf, status);
|
||||
|
||||
@@ -592,6 +592,12 @@ void SetLogger(LogFunc func, unsigned int min_level) {
|
||||
logger.set_min_level(min_level);
|
||||
}
|
||||
|
||||
void SetDefaultLogger(unsigned int min_level) {
|
||||
Logger& logger = Logger::GetInstance();
|
||||
logger.SetDefaultLogger();
|
||||
logger.set_min_level(min_level);
|
||||
}
|
||||
|
||||
//
|
||||
// Utility Functions
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user