0001 TPLOG(3)
0002 ========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 tplog - Print log message to current logger
0009
0010
0011 SYNOPSIS
0012 --------
0013 #include <ndebug.h>
0014
0015 void tplog(int 'lev', char *'message');
0016
0017 or
0018
0019 #define TP_LOG('lev', 'fmt', ...)
0020
0021 Link with '-lnstd -lpthread -lrt -lm'
0022
0023 DESCRIPTION
0024 -----------
0025 Function writes the message to current log file. 'lev' is logging level. For function version
0026 log message goes as 'message' parameter. For C/C++ coding it is recommended to
0027 use macro version *TP_LOG*, as it have a format string and it uses more efficient way
0028 to check the logging levels. Macro version have less functions calls during the whole process.
0029
0030 Log levels are following (from ndebug.h):
0031
0032 - log_always 1
0033
0034 - log_error 2
0035
0036 - log_warn 3
0037
0038 - log_info 4
0039
0040 - log_debug 5
0041
0042
0043 RETURN VALUE
0044 ------------
0045 N/A
0046
0047 ERRORS
0048 ------
0049 N/A
0050
0051 EXAMPLE
0052 -------
0053
0054 Code logtest.c
0055
0056 ---------------------------------------------------------------------
0057 #include <ndebug.h>
0058
0059 int main (int argc, char **argv)
0060 {
0061 tplog(5, "Hello from function logger");
0062
0063 TP_LOG(log_debug, "Hello from macro logger [logging level %d]", log_debug);
0064
0065 return 0;
0066 }
0067 ---------------------------------------------------------------------
0068
0069 Sample run:
0070 ---------------------------------------------------------------------
0071 $ cc logtest.c -lnstd -lpthread -lrt -lm -I /include
0072 $ ./a.out
0073 t:USER:5:11064:000:20160928:100225252:/tplog.c:0412:Hello from function logger
0074 t:USER:5:11064:000:20160928:100225252:ogtest.c:0007:Hello from macro logger [logging level 5]
0075 ---------------------------------------------------------------------
0076
0077 BUGS
0078 ----
0079 Report bugs to support@mavimax.com
0080
0081 SEE ALSO
0082 --------
0083 *tplogdump(3)* *tplogdumpdiff(3)* *tplogprintubf(3)* *tplogconfig(3)* *tplogsetreqfile_direct(3)* *tplogsetreqfile(3)* *ex_devguide(guides)*
0084
0085 COPYING
0086 -------
0087 (C) Mavimax, Ltd
0088