]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme-cli: add generic logging functionality
authorMartin Wilck <mwilck@suse.com>
Tue, 12 Jan 2021 18:50:05 +0000 (19:50 +0100)
committerMartin Wilck <mwilck@suse.com>
Tue, 30 Mar 2021 15:46:12 +0000 (17:46 +0200)
commit0cce8cc53454d49eb185909cfb40f9da5d4adeea
treeef910bb2b615e04642e556af0c92a7659b231026
parent8e18427acf9fee6e098b5e8fd03d0fd4b9d6fece
nvme-cli: add generic logging functionality

Add a msg() macro that allows more flexible customization of logging
both at build time and at run time. Allow several log levels, using
the well-known standard sylog levels. Also optionally allow printing
of log timestamps.

Put '#define LOG_FUNCNAME' before '#include "util/log.h"' to enable printing
the name of the calling function before the log message.

Use this functionality in the fabrics code for now, wherever fprintf(stderr, ...)
had been used.

No functional change except changing the output channel of 554db7d ("print
device name when creating a persistent device") from stdout to stderr.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Makefile
fabrics.c
util/log.c [new file with mode: 0644]
util/log.h [new file with mode: 0644]