]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
dout: add macros for libfmt-style logging
authorCasey Bodley <cbodley@redhat.com>
Mon, 24 Jun 2024 15:23:36 +0000 (11:23 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 25 Jun 2024 18:38:21 +0000 (14:38 -0400)
commita58d07aaa39b7852fc6c79563c2ae8c92d853d4d
treea3f201eba8d2325f295ca75e5f33bf2872e1bf97
parentc80f7fd3f9a888f6333ceecb58abe43752711bac
dout: add macros for libfmt-style logging

new dout macros use fmt::print() to write output directly to the
underlying ostream. this enables libfmt's printf-style formatting syntax
for ceph log output, without the string allocation overhead of:

    dout(10) << fmt::format("str={} count={}", str, count) << dendl;

which becomes:

    dout_fmt(10, "str={} count={}", str, count);

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/common/dout_fmt.h [new file with mode: 0644]
src/test/common/CMakeLists.txt
src/test/common/test_dout_fmt.cc [new file with mode: 0644]