das attorney 858 Posted July 25, 2017 Can't be bothered to keep typing: diag_log format ["test value: %1",_valueToTest]; ? Put this at the top of your scripts: #define diag(a) \ private _pox = toArray str {a}; \ _pox deleteAt count _pox -1; \ _pox deleteAt 0; \ diag_log format ["MyScriptName" + " " + toString _pox + ": %1",a] Then you can type: diag(_valueToTest); And it prints the script name, variablename and value into the log. So these.... _lookAtTheVariableName = 69; diag(_lookAtTheVariableName); _fun = ["stuff","n","ting"]; diag(_fun); _fun = false; diag(_fun); diag(2>1); diag(2 isEqualTo 2); diag(["hello"]); Outputs this.... 18:22:47 "MyScriptName _lookAtTheVariableName: 69" 18:22:47 "MyScriptName _fun: [""stuff"",""n"",""ting""]" 18:22:47 "MyScriptName _fun: false" 18:22:47 "MyScriptName 2>1: true" 18:22:47 "MyScriptName 2 isEqualTo 2: true" 18:22:47 "MyScriptName [""hello""]: [""hello""]" 2 Share this post Link to post Share on other sites
tirpitz 15 Posted July 25, 2017 I use this in a header file that I include where needed, simple version: has three levels of logging. #ifndef tirpDebug #define tirpDebug 0 //define desired value for debug level before including this file (0-3) #endif #ifndef fileName #define fileName "UNKNOWN" #endif #define ERROR(MSG) if (tirpDebug >= 1) then {diag_log ("Tirp ERROR ("+ fileName + "): " + MSG );hint ("Tirp ERROR ("+ fileName+"): " + MSG );} #define INFO(MSG) if (tirpDebug >= 2) then {diag_log ("Tirp INFO (" + fileName + "): " + MSG );} #define DEBUG(MSG) if (tirpDebug >= 3) then {diag_log ("Tirp DEBUG ("+ fileName + "): " + MSG );hint ("Tirp DEBUG ("+ fileName+"): " + MSG );} advanced version, allows some messages to be logged permanently and another set logged only when a value is defined in that file to help reduce RPT spam. #ifndef tirpDebug #define tirpDebug 0 #endif #ifndef DEBUGTHIS #define DEBUGTHIS false #endif #ifndef fileName #define fileName "UNKNOWN" #endif #define ERROR(MSG) if (tirpDebug >= 1) then {diag_log ("Tirp ERROR ("+ fileName + "): " + MSG );hint ("Tirp ERROR ("+ fileName+"): " + MSG );} #define INFO(MSG) if (tirpDebug >= 2) then {diag_log ("Tirp INFO (" + fileName + "): " + MSG );} #define DEBUG(MSG) if (tirpDebug >= 3) then {diag_log ("Tirp DEBUG ("+ fileName + "): " + MSG );hint ("Tirp DEBUG ("+ fileName+"): " + MSG );} #define DEBUG2(MSG) if (tirpDebug >= 3 && DEBUGTHIS ) then {diag_log ("Tirp DEBUG ("+ fileName + "): " + MSG );hint ("Tirp DEBUG ("+ fileName+"): " + MSG );} in script file: #define fileName "fn_AI.sqf" #define DEBUGTHIS true //this line enables extra loggin for this file only #include "MACRO.h" 1 Share this post Link to post Share on other sites