--- title: "How do I redirect debug output?" source_url: https://dev.digicert.com/trustcore-sdk/nanossl/faqs/how-do-i-redirect-debug-output.html --- **Question:** How do I redirect the TrustCore SDK debug output so that it uses my custom debug API? **Answer:** Modify the `dbgConsolePrint` routine in the `debug_console.c` file and insert the custom debugging code. To redirect debug output to custom routines without modifying any TrustCore SDK source code, remap the debug function definitions in the `moptions.h` file to point to these routines. For example, the following definitions redirect the TrustCore SDK `DEBUG_*` calls to use an alternate set of custom routines that begin with `MY_DEBUG_`. ```c #define __ENABLE_CUSTOM_DEBUG_CONSOLE_DEFS__ #define DEBUG_PRINT(X,Y) MY_DEBUG_CONSOLE_printString(X,Y) #define DEBUG_INT(X,Y) MY_DEBUG_CONSOLE_printInteger(X,Y) #define DEBUG_INT2(X,Y,Z) MY_DEBUG_CONSOLE_printInteger2(X,Y,Z) #define DEBUG_INT3(P,Q,R,S) MY_DEBUG_CONSOLE_printInteger3(P,Q,R,S) #define DEBUG_INT4(V,W,X,Y,Z) MY_DEBUG_CONSOLE_printInteger4(V,W,X,Y,Z) #define DEBUG_UINT(X,Y) MY_DEBUG_CONSOLE_printUnsignedInteger(X,Y) #define DEBUG_UINT2(X,Y,Z) MY_DEBUG_CONSOLE_printUnsignedInteger2(X,Y,Z) #define DEBUG_UINT3(W,X,Y,Z) MY_DEBUG_CONSOLE_printUnsignedInteger3(W,X,Y,Z) #define DEBUG_UINT4(V,W,X,Y,Z) MY_DEBUG_CONSOLE_printUnsignedInteger4(V,W,X,Y,Z) #define DEBUG_PRINTNL(X,Y) MY_DEBUG_CONSOLE_printNewLine(X,Y) #define DEBUG_UPTIME(X) MY_DEBUG_CONSOLE_printUpTime(X) #define DEBUG_ERROR(X,Y,Z) MY_DEBUG_CONSOLE_printError(X,Y,Z) #define DEBUG_PRINT3(W,X,Y,Z) MY_DEBUG_CONSOLE_print3(W,X,Y,Z) #define DEBUG_HEXBYTE(X,Y) MY_DEBUG_CONSOLE_hexByte(X,Y) #define DEBUG_HEXINT(X,Y) MY_DEBUG_CONSOLE_hexInt(X,Y) #define DEBUG_HEXINT2(X,Y,Z) MY_DEBUG_CONSOLE_hexInt2(X,Y,Z) #define DEBUG_HEXINT3(W,X,Y,Z) MY_DEBUG_CONSOLE_hexInt3(W,X,Y,Z) #define DEBUG_HEXINT4(V,W,X,Y,Z) MY_DEBUG_CONSOLE_hexInt4(V,W,X,Y,Z) #define DEBUG_PRINTBYTE(X,Y) MY_DEBUG_CONSOLE_printByte(X,Y) #define DEBUG_HEXDUMP(X,Y,Z) MY_DEBUG_CONSOLE_hexDump(X,Y,Z) #define DEBUG_ASCIPADDR (X,Y) MY_DEBUG_CONSOLE_printAsciiIPAddr(X,Y) #define DEBUG_PRINTSTR2INT2(V,W,X,Y,Z) MY_DEBUG_CONSOLE_printString2Int2(V,W,X,Y,Z) #define DEBUG_PRINTSTR2HEXINT2(V,W,X,Y,Z) MY_DEBUG_CONSOLE_printString2HexInt2(V,W,X,Y,Z) #define DEBUG_PRINTSTR1INT1(X,Y,Z) MY_DEBUG_CONSOLE_printString1Int1(X,Y,Z) #define DEBUG_PRINTSTR1HEXINT1(X,Y,Z) MY_DEBUG_CONSOLE_printString1HexInt1(X,Y,Z) #define DEBUG_PRINTSTR1ASCIPADDR1(X,Y,Z) MY_DEBUG_CONSOLE_printString1AsciiIPAddr(X,Y,Z) #define DEBUG_PRINT2(X,Y,Z) MY_DEBUG_CONSOLE_printString2(X,Y,Z) ```