Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize XEH and Versioning logging prefixs #1267

Merged
merged 5 commits into from
Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions addons/versioning/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ SCRIPT(XEH_postInit);
*/

if (!SLX_XEH_DisableLogging) then {
private _logMsg = "CBA_VERSIONING: ";
private _logMsgs = [];
private _filter = {if (_x isEqualType 1) then {[_x] call CBA_fnc_formatNumber} else {_x}};
[GVAR(versions), { _logMsg = (_logMsg + format["%1=%2, ", _key, ([_value select 0, _filter] call CBA_fnc_filter) joinString "."])}] call CBA_fnc_hashEachPair;
[GVAR(versions), { _logMsgs pushBack format["%1=%2", _key, ([_value select 0, _filter] call CBA_fnc_filter) joinString "."]}] call CBA_fnc_hashEachPair;
private _logMsg = _logMsgs joinString ", ";

diag_log [diag_frameNo, diag_tickTime, time, _logMsg];
INFO_2("%1 VERSIONING:%2", [ARR_3(diag_frameNo, diag_tickTime, time)], _logMsg);
};

// Dependency check and warn
Expand Down
8 changes: 4 additions & 4 deletions addons/versioning/XEH_postInitClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ if (isServer) exitWith {};
SLX_XEH_STR spawn {
waitUntil {!(isNil QGVAR(versions_serv))};
if (!SLX_XEH_DisableLogging) then {
private "_logMsg";
_logMsg = "CBA_VERSIONING_SERVER: ";
[GVAR(versions_serv), { _logMsg = (_logMsg + format["%1=%2, ", _key, (_value select 0) joinString "."])}] call CBA_fnc_hashEachPair;
private _logMsgs = [];
[GVAR(versions_serv), { _logMsgs pushBack format["%1=%2", _key, (_value select 0) joinString "."]}] call CBA_fnc_hashEachPair;
private _logMsg = _logMsgs joinString ", ";

diag_log [diag_frameNo, diag_tickTime, time, _logMsg];
INFO_2("%1 VERSIONING_SERVER:%2", [ARR_3(diag_frameNo, diag_tickTime, time)], _logMsg);
};
[GVAR(versions_serv), {call FUNC(version_check)}] call CBA_fnc_hashEachPair;
};
1 change: 1 addition & 0 deletions addons/versioning/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_VERSIONING
#endif

#define DEBUG_SYNCHRONOUS
#include "\x\cba\addons\main\script_macros.hpp"
2 changes: 1 addition & 1 deletion addons/xeh/fnc_addClassEventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private _config = configFile >> "CfgVehicles" >> _className;

// init fallback loop when executing on incompatible class for the first time
if (!GVAR(fallbackRunning) && {ISINCOMP(_className)}) then {
diag_log text format ["[XEH]: One or more children of class %1 do not support Extended Event Handlers. Fall back to loop.", configName _config];
WARNING_1("One or more children of class %1 do not support Extended Event Handlers. Fall back to loop.", configName _config);
PabstMirror marked this conversation as resolved.
Show resolved Hide resolved
call CBA_fnc_startFallbackLoop;
};

Expand Down
4 changes: 2 additions & 2 deletions addons/xeh/fnc_compileEventHandlers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private _allowRecompile = _baseConfig isEqualTo configFile;

if (_allowRecompile) then {
if ("compile" call CBA_fnc_isRecompileEnabled || {isFilePatchingEnabled}) then {
XEH_LOG("XEH: init function preProcessing disabled [recompile or filepatching enabled]");
XEH_LOG("init function preProcessing disabled [recompile or filepatching enabled]");
_allowRecompile = false;
};
};
Expand Down Expand Up @@ -123,7 +123,7 @@ if (_allowRecompile) then {
if (_eventName == "fired") then {
// generate backwards compatible format of _this
_eventFuncBase = "private _this = [_this select 0, _this select 1, _this select 2, _this select 3, _this select 4, _this select 6, _this select 5];";
diag_log text format ["[XEH]: Usage of deprecated Extended Event Handler ""fired"". Use ""firedBIS"" instead. Path: %1\%2\%3\%4.", configSourceMod _x, _baseConfig, XEH_FORMAT_CONFIG_NAME(_eventName), _className];
WARNING_4("Usage of deprecated Extended Event Handler ""fired"". Use ""firedBIS"" instead. Path: %1\%2\%3\%4.", configSourceMod _x, _baseConfig, XEH_FORMAT_CONFIG_NAME(_eventName), _className);
};

{
Expand Down
2 changes: 1 addition & 1 deletion addons/xeh/fnc_initDisplay3DEN.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ params ["_display"];

private _fnc_watchDog = {
if (!ISPROCESSED(missionNamespace)) then {
diag_log text format ["XEH: missionNamespace processed [%1]", ISPROCESSED(missionNamespace)];
INFO_1("missionNamespace processed [%1]", ISPROCESSED(missionNamespace));
[] call CBA_fnc_preInit;
};
};
Expand Down
4 changes: 2 additions & 2 deletions addons/xeh/fnc_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Author:
---------------------------------------------------------------------------- */

isNil {
XEH_LOG("XEH: PostInit started. " + PFORMAT_9("MISSIONINIT",missionName,missionVersion,worldName,isMultiplayer,isServer,isDedicated,CBA_isHeadlessClient,hasInterface,didJIP));
XEH_LOG("PostInit started. " + PFORMAT_9("MISSIONINIT",missionName,missionVersion,worldName,isMultiplayer,isServer,isDedicated,CBA_isHeadlessClient,hasInterface,didJIP));

// fix CBA_missionTime being -1 on (non-JIP) clients at mission start.
if (CBA_missionTime == -1) then {
Expand Down Expand Up @@ -60,7 +60,7 @@ isNil {

SLX_XEH_MACHINE set [8, true]; // PostInit passed

XEH_LOG("XEH: PostInit finished.");
XEH_LOG("PostInit finished.");
};

nil
10 changes: 5 additions & 5 deletions addons/xeh/fnc_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Author:
---------------------------------------------------------------------------- */

if (ISPROCESSED(missionNamespace)) exitWith {
diag_log text "[XEH]: preInit already executed. Abort preInit.";
XEH_LOG("preInit already executed. Abort preInit.");
};
SETPROCESSED(missionNamespace);

SLX_XEH_DisableLogging = uiNamespace getVariable ["SLX_XEH_DisableLogging", false]; // get from preStart

XEH_LOG("XEH: PreInit started. v" + getText (configFile >> "CfgPatches" >> "cba_common" >> "versionStr"));
XEH_LOG("PreInit started. v" + getText (configFile >> "CfgPatches" >> "cba_common" >> "versionStr"));

SLX_XEH_STR = ""; // does nothing, never changes, backwards compatibility
SLX_XEH_COMPILE = compileFinal "compile preprocessFileLineNumbers _this"; //backwards comps
Expand Down Expand Up @@ -90,7 +90,7 @@ GVAR(incompatible) = [] call CBA_fnc_createNamespace;

// always recompile extended event handlers
#ifdef DEBUG_MODE_FULL
XEH_LOG("XEH: Compiling XEH START");
XEH_LOG("Compiling XEH START");
#endif

//Get configFile eventhandlers from cache that was generated at preStart
Expand All @@ -101,7 +101,7 @@ GVAR(allEventHandlers) = call (uiNamespace getVariable [QGVAR(configFileEventHan
} forEach [campaignConfigFile, missionConfigFile];

#ifdef DEBUG_MODE_FULL
XEH_LOG("XEH: Compiling XEH END");
XEH_LOG("Compiling XEH END");
#endif

// add extended event handlers to classes
Expand Down Expand Up @@ -192,4 +192,4 @@ if (!isServer) then { // only on client
}] call CBA_fnc_addEventHandler;
#endif

XEH_LOG("XEH: PreInit finished.");
XEH_LOG("PreInit finished.");
8 changes: 4 additions & 4 deletions addons/xeh/fnc_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Author:
with uiNamespace do {
SLX_XEH_DisableLogging = isClass (configFile >> "CfgPatches" >> "Disable_XEH_Logging");

XEH_LOG("XEH: PreStart started.");
XEH_LOG("PreStart started.");

SLX_XEH_COMPILE = compileFinal "compile preprocessFileLineNumbers _this"; //backwards comps
SLX_XEH_COMPILE_NEW = CBA_fnc_compileFunction; //backwards comp
Expand Down Expand Up @@ -53,16 +53,16 @@ with uiNamespace do {
diag_log text format ["isScheduled = %1", call CBA_fnc_isScheduled];
#endif

XEH_LOG("XEH: PreStart finished.");
XEH_LOG("PreStart finished.");

// check extended event handlers compatibility
{
_x params ["_classname", "_addon"];

if (_addon == "") then {
diag_log text format ["[XEH]: %1 does not support Extended Event Handlers!", _classname];
WARNING_1("%1 does not support Extended Event Handlers!", _classname);
} else {
diag_log text format ["[XEH]: %1 does not support Extended Event Handlers! Addon: %2", _classname, _addon];
WARNING_2("%1 does not support Extended Event Handlers! Addon: %2", _classname, _addon);
};
} forEach (true call CBA_fnc_supportMonitor);

Expand Down
3 changes: 2 additions & 1 deletion addons/xeh/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_XEH
#endif

#define DEBUG_SYNCHRONOUS
#include "\x\cba\addons\main\script_macros.hpp"

#define XEH_LOG(msg) if (!SLX_XEH_DisableLogging) then { diag_log [diag_frameNo, diag_tickTime, time, msg] }
#define XEH_LOG(msg) if (!SLX_XEH_DisableLogging) then { INFO_2("%1 %2",[ARR_3(diag_frameNo, diag_tickTime, time)], msg); }

#define SYS_EVENTHANDLERS(type,class) format [QGVAR(%1:%2), type, class]
#define EVENTHANDLERS(type,class) (missionNamespace getVariable [SYS_EVENTHANDLERS(type,class), []])
Expand Down