Sound Byte Libs 1ee2ca6
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Namespaces | Classes | Enumerations | Functions
sbl::log Namespace Reference

Namespaces

namespace  detail
 

Classes

class  Logger
 Logger class with compile-time level filtering. More...
 
struct  NullOutput
 Null output sink (discards all output) More...
 
struct  NullTimestamp
 Default timestamp provider (returns 0) More...
 

Enumerations

enum class  Level : uint8_t {
  Off = 0 , Error = 1 , Warn = 2 , Info = 3 ,
  Debug = 4 , Trace = 5
}
 Log severity levels. More...
 

Functions

int vformat (char *buf, size_t size, const char *fmt, va_list args)
 Format a string into a buffer (vsnprintf-style)
 
int format (char *buf, size_t size, const char *fmt,...)
 Format a string into a buffer (snprintf-style)
 
constexpr char level_char (Level level)
 Convert level to single character.
 
constexpr const char * basename (const char *path)
 Extract filename from path (compile-time safe)
 

Enumeration Type Documentation

◆ Level

enum class sbl::log::Level : uint8_t
strong

Log severity levels.

Enumerator
Off 
Error 
Warn 
Info 
Debug 
Trace 

Definition at line 26 of file logger.hpp.

Function Documentation

◆ basename()

constexpr const char * sbl::log::basename ( const char *  path)
constexpr

Extract filename from path (compile-time safe)

Returns pointer to last path component (e.g., "main.cpp" from "/foo/bar/main.cpp")

Definition at line 70 of file logger.hpp.

Referenced by sbl::log::Logger< Output, TimestampProvider, MinLevel >::log().

Here is the caller graph for this function:

◆ format()

int sbl::log::format ( char *  buf,
size_t  size,
const char *  fmt,
  ... 
)
inline

Format a string into a buffer (snprintf-style)

Parameters
bufOutput buffer
sizeBuffer size
fmtFormat string
...Arguments
Returns
Number of characters that would have been written (excluding null)

Definition at line 230 of file format.hpp.

References vformat().

Referenced by sbl::log::Logger< Output, TimestampProvider, MinLevel >::log(), and sbl::log::Logger< Output, TimestampProvider, MinLevel >::log_simple().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ level_char()

constexpr char sbl::log::level_char ( Level  level)
constexpr

Convert level to single character.

Definition at line 38 of file logger.hpp.

References Debug, Error, Info, Trace, and Warn.

Referenced by sbl::log::Logger< Output, TimestampProvider, MinLevel >::log(), and sbl::log::Logger< Output, TimestampProvider, MinLevel >::log_simple().

Here is the caller graph for this function:

◆ vformat()

int sbl::log::vformat ( char *  buf,
size_t  size,
const char *  fmt,
va_list  args 
)
inline

Format a string into a buffer (vsnprintf-style)

Parameters
bufOutput buffer
sizeBuffer size
fmtFormat string
argsVariadic argument list
Returns
Number of characters that would have been written (excluding null)

Definition at line 35 of file format.hpp.

Referenced by format(), sbl::log::Logger< Output, TimestampProvider, MinLevel >::log(), and sbl::log::Logger< Output, TimestampProvider, MinLevel >::log_simple().

Here is the caller graph for this function: