Back to home page

Enduro/X

 
 

    


0001 TPLOGDUMP(3)
0002 ============
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 tplogdump - Print hex-dump of byte array to current logger
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 #include <ndebug.h>
0014 
0015 void tplogdump(int 'lev', char *'comment', void *'ptr', int 'len');
0016 
0017 or
0018 
0019 #define TP_DUMP('lev','comment','ptr','len')
0020 
0021 Link with '-lnstd -lpthread -lrt -lm'
0022 
0023 DESCRIPTION
0024 -----------
0025 Function writes a hex dump of 'ptr' byte array of length 'len' to current logger 
0026 (process based, thread based or request based). The *tplogdump()* basically is wrapper for *TP_LOGDUMP*.
0027 For C/C++ programs it is recommended to use macro version. 'lev' is debug level from which start the
0028 logging Comment is title line of the dump.
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 dumptest.c
0055 
0056 ---------------------------------------------------------------------
0057 #include <ndebug.h>
0058 
0059 int main (int argc, char **argv)
0060 {
0061         char arr1[32];
0062         int i;
0063 
0064         for (i=0; i<sizeof(arr1); i++)
0065         {
0066                 arr1[i]=(char)(65+i);
0067         }
0068         
0069         tplogdump(5, "The dump", arr1, sizeof(arr1));
0070         
0071                 TP_DUMP(log_debug, "The dump from TP_DUMP", arr1, sizeof(arr1));
0072 
0073         return 0;
0074 }
0075 ---------------------------------------------------------------------
0076 
0077 Sample run:
0078 ---------------------------------------------------------------------
0079 $ cc  dumptest.c -lnstd -lpthread -lrt -lm -I /include
0080 $ ./a.out 
0081 t:USER:5:10598:000:20160928:095228766:/tplog.c:0424:The dump
0082   0000  41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50  ABCDEFGHIJKLMNOP
0083   0010  51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60  QRSTUVWXYZ[\]^_`
0084 t:USER:5:10598:000:20160928:095228766:mptest.c:0015:The dump from TP_DUMP
0085   0000  41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50  ABCDEFGHIJKLMNOP
0086   0010  51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60  QRSTUVWXYZ[\]^_`
0087 ---------------------------------------------------------------------
0088 
0089 BUGS
0090 ----
0091 Report bugs to support@mavimax.com
0092 
0093 SEE ALSO
0094 --------
0095 *tplogdumpdiff(3)* *tplog(3)* *tplogprintubf(3)* *tplogconfig(3)* *tplogsetreqfile_direct(3)* *tplogsetreqfile(3)* *ex_devguide(guides)*
0096 
0097 COPYING
0098 -------
0099 (C) Mavimax, Ltd
0100