Skip to content

Commit

Permalink
remove more
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jul 31, 2024
1 parent d3bda41 commit 909ca15
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 179 deletions.
12 changes: 6 additions & 6 deletions src/utils/fmt_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,41 @@ extern std::shared_ptr<spdlog::logger> file_logger;
#define LOG(level, ...) \
do { \
if (level >= log_start_level) \
file_logger->log(level, __VA_ARGS__); \
file_logger->log(level, __VA_ARGS__); \
} while (false)

extern spdlog::level::level_enum stderr_start_level;
#define LOG_DEBUG(...) \
do { \
SPDLOG_LOGGER_DEBUG(file_logger, __VA_ARGS__); \
SPDLOG_LOGGER_DEBUG(file_logger, __VA_ARGS__); \
if (spdlog::level::debug >= stderr_start_level) { \
SPDLOG_LOGGER_DEBUG(stderr_logger, __VA_ARGS__); \
} \
} while (false)
#define LOG_INFO(...) \
do { \
SPDLOG_LOGGER_INFO(file_logger, __VA_ARGS__); \
SPDLOG_LOGGER_INFO(file_logger, __VA_ARGS__); \
if (spdlog::level::info >= stderr_start_level) { \
SPDLOG_LOGGER_INFO(stderr_logger, __VA_ARGS__); \
} \
} while (false)
#define LOG_WARNING(...) \
do { \
SPDLOG_LOGGER_WARN(file_logger, __VA_ARGS__); \
SPDLOG_LOGGER_WARN(file_logger, __VA_ARGS__); \
if (spdlog::level::warn >= stderr_start_level) { \
SPDLOG_LOGGER_WARN(stderr_logger, __VA_ARGS__); \
} \
} while (false)
#define LOG_ERROR(...) \
do { \
SPDLOG_LOGGER_ERROR(file_logger, __VA_ARGS__); \
SPDLOG_LOGGER_ERROR(file_logger, __VA_ARGS__); \
if (spdlog::level::err >= stderr_start_level) { \
SPDLOG_LOGGER_ERROR(stderr_logger, __VA_ARGS__); \
} \
} while (false)
#define LOG_FATAL(...) \
do { \
SPDLOG_LOGGER_CRITICAL(file_logger, __VA_ARGS__); \
SPDLOG_LOGGER_CRITICAL(file_logger, __VA_ARGS__); \
if (spdlog::level::critical >= stderr_start_level) { \
SPDLOG_LOGGER_CRITICAL(stderr_logger, __VA_ARGS__); \
} \
Expand Down
10 changes: 5 additions & 5 deletions src/utils/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ DSN_DEFINE_validator(max_number_of_log_files_on_disk,

DSN_DEFINE_string(tools.simple_logger, base_name, "pegasus", "The default base name for log file");
DSN_DEFINE_string(
tools.simple_logger,
stderr_start_level,
"LOG_LEVEL_WARNING",
"The lowest level of log messages to be copied to stderr in addition to log files");
tools.simple_logger,
stderr_start_level,
"LOG_LEVEL_WARNING",
"The lowest level of log messages to be copied to stderr in addition to log files");
DSN_DEFINE_validator(stderr_start_level, [](const char *value) -> bool {
const auto level = enum_from_string(value, LOG_LEVEL_INVALID);
return LOG_LEVEL_DEBUG <= level && level <= LOG_LEVEL_FATAL;
Expand Down Expand Up @@ -115,7 +115,7 @@ void dsn_log_init(const std::string &log_dir,

// register log flush on exit
if (FLAGS_logging_flush_on_exit) {
// ::dsn::tools::sys_exit.put_back(log_on_sys_exit, "log.flush");
// ::dsn::tools::sys_exit.put_back(log_on_sys_exit, "log.flush");
}

//
Expand Down
7 changes: 2 additions & 5 deletions src/utils/simple_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,8 @@ simple_logger::simple_logger(const char *log_dir, const char *role_name)
// command_manager is destroyed, however 'flush-log' is still registered".
// We need to fix it.
_cmds.emplace_back(::dsn::command_manager::instance().register_single_command(
"flush-log",
"Flush log to stderr or file",
"",
[](const std::vector<std::string> &args) {
// this->flush();
"flush-log", "Flush log to stderr or file", "", [](const std::vector<std::string> &args) {
// this->flush();
return "Flush done.";
}));

Expand Down
163 changes: 0 additions & 163 deletions src/utils/test/logger.cpp

This file was deleted.

0 comments on commit 909ca15

Please sign in to comment.