Skip to content

Commit

Permalink
LOG TRACE FORMAT
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 29, 2024
1 parent b95c5c9 commit 670afdc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nano/lib/logging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,19 @@ class logger final
{
if constexpr (is_tracing_enabled ())
{
debug_assert (detail != nano::log::detail::all);

// Include info about precise time of the event
auto now = std::chrono::high_resolution_clock::now ();
auto now_micros = std::chrono::duration_cast<std::chrono::microseconds> (now.time_since_epoch ()).count ();

// TODO: Improve code indentation config
auto logger = get_logger (type, detail);
logger.trace ("{}", nano::object_streamed_args (global_tracing_config, nano::log::arg{ "event", detail }, std::forward<Args> (args)...));
logger.trace ("{}",
nano::object_streamed_args (global_tracing_config,
nano::log::arg{ "event", to_string (std::make_pair (type, detail)) },
nano::log::arg{ "time", now_micros },
std::forward<Args> (args)...));
}
}

Expand Down

0 comments on commit 670afdc

Please sign in to comment.