microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Namespaces
default_log_sink.template.hpp File Reference

Documentation-only scaffold for MICROFMT_DEFAULT_LOG_SINK_BACKEND_CUSTOM. More...

#include <sys/syslog.h>
#include <sys/systm.h>
Include dependency graph for default_log_sink.template.hpp:

Go to the source code of this file.

Classes

struct  microfmt::log::kernel_log_sink_tag
 Tag selecting kernel_log_sink as a log_sink backend. More...
 
struct  microfmt::log::log_sink_traits< kernel_log_sink_tag >
 
class  microfmt::log::kernel_log_sink
 Adapter that writes structured records to the FreeBSD kernel's log(9). More...
 

Namespaces

namespace  microfmt
 
namespace  microfmt::log
 
namespace  microfmt::log::detail
 Fixed-capacity logger that formats records before dispatching to sinks.
 

Detailed Description

Documentation-only scaffold for MICROFMT_DEFAULT_LOG_SINK_BACKEND_CUSTOM.

Never #included by anything – copy this file to detail/porting/default_log_sink.hpp (dropping .template), fill it in for your actual target, and define MICROFMT_DEFAULT_LOG_SINK_BACKEND_CUSTOM (see microfmt/log/logger.hpp/microfmt/microfmt_config.hpp), or point the JPLCZ_MICROFMT_PORTING_HEADERS CMake variable at a directory containing your finished default_log_sink.hpp and let the build do both for you.

Sketches, loosely, what a FreeBSD kernel port might look like, backed by log(9) (the kernel's own syslog-priority-tagged logging facility, draining to /var/log/messages via syslogd and to the console when above the console log level – see sys/syslog.h/ sys/systm.h) instead of the built-in userspace stdout_color_sink. This is illustrative, not exact or complete – a real port has its own conventions for which subsystem/facility to tag records with (log() itself takes no separate facility argument beyond the LOG_* priority baked into the level mapping below), and is not compiled or exercised by this repository (which targets hosted userspace, not the FreeBSD kernel proper). See microfmt::log::syslog_sink (microfmt/sinks/syslog_sink.hpp) for this same idea's userspace counterpart, which this scaffold otherwise mirrors closely.

Defines the whole microfmt::log::detail::built_in_default_logger() noexcept -> logger & entry point (not merely a sink helper), giving this port full control over the resulting logger too – its name, sink count/capacity, locking policy – exactly as the built-in stdout_color_sink-backed definition this replaces does.

Deliberately does not #include any of microfmt's own headers back (e.g. log/sink.hpp for log_sink/log_msg/level/buffer_sink): this file is spliced in by logger.hpp only after already including them itself, so they are always in scope by the time this file is reached, exactly like mutex.template.hpp relies on RELOCO_CAPABILITY etc. already being visible from its own inclusion context.