Skip to content

Commit

Permalink
Docs: minor fixup - inserting API details (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C authored Jan 17, 2025
1 parent 737eec0 commit ea6bcff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 10 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@ utl::info("MyCtx", "Message").attrs({{"key1", "value1"}, {"key2", "value2"}});
```
### API details
:::{doxygenfunction} utl::log
:::{doxygenstruct} utl::log
:::
:::{doxygenstruct} utl::debug
:::
:::{doxygenstruct} utl::info
:::
:::{doxygenstruct} utl::error
:::
:::{note}
Expand Down
5 changes: 4 additions & 1 deletion include/utl/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ inline std::string now() {
return ss.str();
}

/// Produce a new log line at the given `level`, with the given message
/// Produce a new log line at the given `level`.
template <log_level LogLevel, typename... Args>
struct log {
log(const char* ctx, fmt::format_string<Args...> fmt_str,
Expand Down Expand Up @@ -91,16 +91,19 @@ struct log {
std::initializer_list<std::pair<std::string_view, std::string_view> > attrs_;
};

/// Produce a new DEBUG log line
template <typename... Args>
struct debug : public log<log_level::debug, Args...> {
using log<log_level::debug, Args...>::log;
};

/// Produce a new INFO log line
template <typename... Args>
struct info : public log<log_level::info, Args...> {
using log<log_level::info, Args...>::log;
};

/// Produce a new ERROR log line
template <typename... Args>
struct error : public log<log_level::error, Args...> {
using log<log_level::error, Args...>::log;
Expand Down

0 comments on commit ea6bcff

Please sign in to comment.