Skip to content

Commit

Permalink
Better version
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero committed Sep 26, 2024
1 parent 59e54e5 commit 02a63f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 6 additions & 8 deletions examples/log/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <filesystem>
#include <gz/utils/log/Logger.hh>

#define sourceLocation {__FILE__, __LINE__, ""}

//////////////////////////////////////////////////
int main(int argc, char** argv)
{
Expand All @@ -31,10 +29,10 @@ int main(int argc, char** argv)
std::filesystem::path logPath = logDir / logFile;
logger.SetLogDestination(logPath);

logger.RawLogger().log(sourceLocation, spdlog::level::trace, "trace\n");
logger.RawLogger().log(sourceLocation, spdlog::level::debug, "debug\n");
logger.RawLogger().log(sourceLocation, spdlog::level::info, "info\n");
logger.RawLogger().log(sourceLocation, spdlog::level::warn, "warn\n");
logger.RawLogger().log(sourceLocation, spdlog::level::err, "error\n");
logger.RawLogger().log(sourceLocation, spdlog::level::critical, "critical\n");
SPDLOG_LOGGER_TRACE(logger.RawLoggerPtr(), "trace\n");
SPDLOG_LOGGER_DEBUG(logger.RawLoggerPtr(), "debug\n");
SPDLOG_LOGGER_INFO(logger.RawLoggerPtr(), "info\n");
SPDLOG_LOGGER_WARN(logger.RawLoggerPtr(), "warn\n");
SPDLOG_LOGGER_ERROR(logger.RawLoggerPtr(), "error\n");
SPDLOG_LOGGER_CRITICAL(logger.RawLoggerPtr(), "critical\n");
}
2 changes: 2 additions & 0 deletions log/include/gz/utils/log/Logger.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef GZ_UTILS_LOG_LOGGER_HH_
#define GZ_UTILS_LOG_LOGGER_HH_

#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE

#include <spdlog/spdlog.h>
#include <memory>
#include <string>
Expand Down

0 comments on commit 02a63f8

Please sign in to comment.