From ce904a797843f816e6bf26a23e52db698a8db04a Mon Sep 17 00:00:00 2001 From: Jacob Schmidt Date: Sun, 23 Mar 2025 23:20:03 -0500 Subject: [PATCH] feat(db): Add debug logging to all DragonflyDB functions Enhanced debugging capabilities by adding conditional logging statements to all DragonflyDB functions. These logs include input parameters and return values, providing detailed insights into function execution. The logging is enabled only when the `__A3__DEBUG__` preprocessor directive is defined, ensuring minimal performance impact in production environments. This change improves the ability to diagnose issues and understand the flow of data within the DragonflyDB system. --- addons/db/functions/fnc_delete.sqf | 8 ++++- addons/db/functions/fnc_get.sqf | 35 +++++++++++++++----- addons/db/functions/fnc_handler.sqf | 8 ++++- addons/db/functions/fnc_hashGet.sqf | 39 ++++++++++++++++++----- addons/db/functions/fnc_hashGetAll.sqf | 39 ++++++++++++++++++----- addons/db/functions/fnc_hashGetAllId.sqf | 39 ++++++++++++++++++----- addons/db/functions/fnc_hashGetId.sqf | 39 ++++++++++++++++++----- addons/db/functions/fnc_hashSet.sqf | 8 ++++- addons/db/functions/fnc_hashSetBulk.sqf | 8 ++++- addons/db/functions/fnc_hashSetId.sqf | 8 ++++- addons/db/functions/fnc_hashSetIdBulk.sqf | 8 ++++- addons/db/functions/fnc_listAdd.sqf | 8 ++++- addons/db/functions/fnc_listGet.sqf | 39 ++++++++++++++++++----- addons/db/functions/fnc_listLoad.sqf | 39 ++++++++++++++++++----- addons/db/functions/fnc_listRemove.sqf | 8 ++++- addons/db/functions/fnc_listSet.sqf | 8 ++++- addons/db/functions/fnc_pubSubFetch.sqf | 4 ++- addons/db/functions/fnc_pubSubHandler.sqf | 4 +++ addons/db/functions/fnc_publish.sqf | 9 +++--- addons/db/functions/fnc_set.sqf | 8 ++++- addons/db/functions/fnc_subscribe.sqf | 11 +++---- addons/db/functions/fnc_test.sqf | 2 +- 22 files changed, 301 insertions(+), 78 deletions(-) diff --git a/addons/db/functions/fnc_delete.sqf b/addons/db/functions/fnc_delete.sqf index a35e6d4..54f3dd2 100644 --- a/addons/db/functions/fnc_delete.sqf +++ b/addons/db/functions/fnc_delete.sqf @@ -30,6 +30,12 @@ params [["_key", "", [""]]]; -if (_key == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_delete' Invalid Input for Key '%1'", _key]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_delete' Key: '%1'", _key]; +#endif + +if (_key == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_delete' Invalid Input for Key '%1'", _key]; +}; "ArmaDragonflyClient" callExtension ["del", [_key]]; \ No newline at end of file diff --git a/addons/db/functions/fnc_get.sqf b/addons/db/functions/fnc_get.sqf index 22360b9..16341aa 100644 --- a/addons/db/functions/fnc_get.sqf +++ b/addons/db/functions/fnc_get.sqf @@ -31,19 +31,38 @@ * Public: Yes */ -params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", nil, [""]]]; +params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; -if (_key == "" || _function == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_get' Invalid Input for Key '%1' or Function '%2'", _key, _function]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_get' Key: '%1', Function: '%2', Call: '%3', NetId: '%4'", _key, _function, _call, _netId]; +#endif + +if (_key == "" || _function == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_get' Invalid Input for Key '%1' or Function '%2'", _key, _function]; +}; + +private _return = ""; + +if (_netId != "") then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_get' Using NetId: '%1'", _netId]; + #endif -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { if (_call) then { _return = "ArmaDragonflyClient" callExtension ["get", [_key, _function, _netId, _call]]; - [(_return select 0)] call FUNC(scheduler); } else { _return = "ArmaDragonflyClient" callExtension ["get", [_key, _function, _netId]]; - [(_return select 0)] call FUNC(scheduler); }; } else { - _return = "ArmaDragonflyClient" callExtension ["get", [_key, _function]]; - [(_return select 0)] call FUNC(scheduler); -}; \ No newline at end of file + #ifdef __A3__DEBUG__ + diag_log text "ArmaDragonflyClient: 'dragonfly_db_fnc_get' Using current player"; + #endif + + if (_call) then { + _return = "ArmaDragonflyClient" callExtension ["get", [_key, _function, _call]]; + } else { + _return = "ArmaDragonflyClient" callExtension ["get", [_key, _function]]; + }; +}; + +[(_return select 0)] call FUNC(scheduler); \ No newline at end of file diff --git a/addons/db/functions/fnc_handler.sqf b/addons/db/functions/fnc_handler.sqf index 43570b4..93fea0a 100644 --- a/addons/db/functions/fnc_handler.sqf +++ b/addons/db/functions/fnc_handler.sqf @@ -34,7 +34,13 @@ params [["_uniqueID", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_data", [], [[]]], ["_netId", nil, [""]]]; -if (_function == "" || count _data == 0) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' Invalid Input for Function '%1' or Data '%2'", _function, _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' UniqueID: '%1', Function: '%2', Call: '%3', Data: '%4', NetId: '%5'", _uniqueID, _function, _call, _data, _netId]; +#endif + +if (_function == "" || count _data == 0) exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' Invalid Input for Function '%1' or Data '%2'", _function, _data]; +}; private _func = call compile format ["%1", _function]; diff --git a/addons/db/functions/fnc_hashGet.sqf b/addons/db/functions/fnc_hashGet.sqf index 46a2d6b..ae88277 100644 --- a/addons/db/functions/fnc_hashGet.sqf +++ b/addons/db/functions/fnc_hashGet.sqf @@ -31,19 +31,42 @@ * Public: Yes */ -params [["_keyField", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", nil, [""]]]; +params [["_keyField", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; -if (_keyField == "" || _function == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGet' Invalid Input for KeyField '%1' or Function '%2'", _keyField, _function]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGet' KeyField: '%1', Function: '%2', Call: '%3', NetId: '%4'", _keyField, _function, _call, _netId]; +#endif + +if (_keyField == "" || _function == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGet' Invalid Input for KeyField '%1' or Function '%2'", _keyField, _function]; +}; + +private _return = ""; + +if (_netId != "") then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGet' Using NetId: '%1'", _netId]; + #endif -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { if (_call) then { _return = "ArmaDragonflyClient" callExtension ["hget", [_keyField, _function, _netId, _call]]; - [(_return select 0)] call FUNC(scheduler); } else { _return = "ArmaDragonflyClient" callExtension ["hget", [_keyField, _function, _netId]]; - [(_return select 0)] call FUNC(scheduler); }; } else { - _return = "ArmaDragonflyClient" callExtension ["hget", [_keyField, _function]]; - [(_return select 0)] call FUNC(scheduler); -}; \ No newline at end of file + #ifdef __A3__DEBUG__ + diag_log text "ArmaDragonflyClient: 'dragonfly_db_fnc_hashGet' Using current player"; + #endif + + if (_call) then { + _return = "ArmaDragonflyClient" callExtension ["hget", [_keyField, _function, _call]]; + } else { + _return = "ArmaDragonflyClient" callExtension ["hget", [_keyField, _function]]; + }; +}; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGet' Return: '%1'", _return]; +#endif + +[(_return select 0)] call FUNC(scheduler); \ No newline at end of file diff --git a/addons/db/functions/fnc_hashGetAll.sqf b/addons/db/functions/fnc_hashGetAll.sqf index d5a2c56..7346e77 100644 --- a/addons/db/functions/fnc_hashGetAll.sqf +++ b/addons/db/functions/fnc_hashGetAll.sqf @@ -30,19 +30,42 @@ * Public: Yes */ -params [["_function", "", [""]], ["_call", false, [false]], ["_netId", nil, [""]]]; +params [["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; -if (_function isEqualTo "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAll' Invalid Input for Function '%1'", _function]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAll' Function: '%1', Call: '%2', NetId: '%3'", _function, _call, _netId]; +#endif + +if (_function isEqualTo "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAll' Invalid Input for Function '%1'", _function]; +}; + +private _return = ""; + +if (_netId != "") then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAll' Using NetId: '%1'", _netId]; + #endif -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { if (_call) then { _return = "ArmaDragonflyClient" callExtension ["hgetall", [_function, _netId, _call]]; - [(_return select 0)] call FUNC(scheduler); } else { _return = "ArmaDragonflyClient" callExtension ["hgetall", [_function, _netId]]; - [(_return select 0)] call FUNC(scheduler); }; } else { - _return = "ArmaDragonflyClient" callExtension ["hgetall", [_function]]; - [(_return select 0)] call FUNC(scheduler); -}; \ No newline at end of file + #ifdef __A3__DEBUG__ + diag_log text "ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAll' Using current player"; + #endif + + if (_call) then { + _return = "ArmaDragonflyClient" callExtension ["hgetall", [_function, _call]]; + } else { + _return = "ArmaDragonflyClient" callExtension ["hgetall", [_function]]; + }; +}; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAll' Return: '%1'", _return]; +#endif + +[(_return select 0)] call FUNC(scheduler); \ No newline at end of file diff --git a/addons/db/functions/fnc_hashGetAllId.sqf b/addons/db/functions/fnc_hashGetAllId.sqf index 55cdd48..99122c3 100644 --- a/addons/db/functions/fnc_hashGetAllId.sqf +++ b/addons/db/functions/fnc_hashGetAllId.sqf @@ -31,19 +31,42 @@ * Public: Yes */ -params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", nil, [""]]]; +params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; -if (_key == "" || _function == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAllId' Invalid Input for Key '%1' or Function '%2'", _key, _function]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAllId' Key: '%1', Function: '%2', Call: '%3', NetId: '%4'", _key, _function, _call, _netId]; +#endif + +if (_key == "" || _function == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAllId' Invalid Input for Key '%1' or Function '%2'", _key, _function]; +}; + +private _return = ""; + +if (_netId != "") then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAllId' Using NetId: '%1'", _netId]; + #endif -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { if (_call) then { _return = "ArmaDragonflyClient" callExtension ["hgetallid", [_key, _function, _netId, _call]]; - [(_return select 0)] call FUNC(scheduler); } else { _return = "ArmaDragonflyClient" callExtension ["hgetallid", [_key, _function, _netId]]; - [(_return select 0)] call FUNC(scheduler); }; } else { - _return = "ArmaDragonflyClient" callExtension ["hgetallid", [_key, _function]]; - [(_return select 0)] call FUNC(scheduler); -}; \ No newline at end of file + #ifdef __A3__DEBUG__ + diag_log text "ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAllId' Using current player"; + #endif + + if (_call) then { + _return = "ArmaDragonflyClient" callExtension ["hgetallid", [_key, _function, _call]]; + } else { + _return = "ArmaDragonflyClient" callExtension ["hgetallid", [_key, _function]]; + }; +}; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAllId' Return: '%1'", _return]; +#endif + +[(_return select 0)] call FUNC(scheduler); \ No newline at end of file diff --git a/addons/db/functions/fnc_hashGetId.sqf b/addons/db/functions/fnc_hashGetId.sqf index 96ad393..489ea5a 100644 --- a/addons/db/functions/fnc_hashGetId.sqf +++ b/addons/db/functions/fnc_hashGetId.sqf @@ -32,19 +32,42 @@ * Public: Yes */ -params [["_key", "", [""]], ["_keyField", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", nil, [""]]]; +params [["_key", "", [""]], ["_keyField", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; -if (_key == "" || _keyField == "" || _function == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetId' Invalid Input for Key '%1', KeyField '%2' or Function '%3'", _key, _keyField, _function]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetId' Key: '%1', KeyField: '%2', Function: '%3', Call: '%4', NetId: '%5'", _key, _keyField, _function, _call, _netId]; +#endif + +if (_key == "" || _keyField == "" || _function == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetId' Invalid Input for Key '%1', KeyField '%2' or Function '%3'", _key, _keyField, _function]; +}; + +private _return = ""; + +if (_netId != "") then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetId' Using NetId: '%1'", _netId]; + #endif -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { if (_call) then { _return = "ArmaDragonflyClient" callExtension ["hgetid", [_key, _keyField, _function, _netId, _call]]; - [(_return select 0)] call FUNC(scheduler); } else { _return = "ArmaDragonflyClient" callExtension ["hgetid", [_key, _keyField, _function, _netId]]; - [(_return select 0)] call FUNC(scheduler); }; } else { - _return = "ArmaDragonflyClient" callExtension ["hgetid", [_key, _keyField, _function]]; - [(_return select 0)] call FUNC(scheduler); -}; \ No newline at end of file + #ifdef __A3__DEBUG__ + diag_log text "ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetId' Using current player"; + #endif + + if (_call) then { + _return = "ArmaDragonflyClient" callExtension ["hgetid", [_key, _keyField, _function, _call]]; + } else { + _return = "ArmaDragonflyClient" callExtension ["hgetid", [_key, _keyField, _function]]; + }; +}; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetId' Return: '%1'", _return]; +#endif + +[(_return select 0)] call FUNC(scheduler); \ No newline at end of file diff --git a/addons/db/functions/fnc_hashSet.sqf b/addons/db/functions/fnc_hashSet.sqf index 4c5f889..e0fdf16 100644 --- a/addons/db/functions/fnc_hashSet.sqf +++ b/addons/db/functions/fnc_hashSet.sqf @@ -31,6 +31,12 @@ params [["_keyField", "", [""]], ["_data", [], [[]]]]; -if (_keyField == "" || count _data == 0) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSet' Invalid Input for KeyField '%1' or Data '%2'", _keyField, _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSet' KeyField: '%1', Data: '%2'", _keyField, _data]; +#endif + +if (_keyField == "" || count _data == 0) exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSet' Invalid Input for KeyField '%1' or Data '%2'", _keyField, _data]; +}; "ArmaDragonflyClient" callExtension ["hset", [_keyField, _data]]; \ No newline at end of file diff --git a/addons/db/functions/fnc_hashSetBulk.sqf b/addons/db/functions/fnc_hashSetBulk.sqf index 10b44ee..faf569f 100644 --- a/addons/db/functions/fnc_hashSetBulk.sqf +++ b/addons/db/functions/fnc_hashSetBulk.sqf @@ -30,6 +30,12 @@ params [["_data", [], [[]]]]; -if (count _data == 0) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetBulk' Invalid Input for Data '%1'", _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetBulk' Data: %1", _data]; +#endif + +if (count _data == 0) exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetBulk' Invalid Input for Data '%1'", _data]; +}; "ArmaDragonflyClient" callExtension ["hset", _data]; \ No newline at end of file diff --git a/addons/db/functions/fnc_hashSetId.sqf b/addons/db/functions/fnc_hashSetId.sqf index 41c9dae..7e5f4c4 100644 --- a/addons/db/functions/fnc_hashSetId.sqf +++ b/addons/db/functions/fnc_hashSetId.sqf @@ -32,6 +32,12 @@ params [["_key", "", [""]], ["_keyField", "", [""]], ["_data", [], [[]]]]; -if (_key == "" || _keyField == "" || count _data == 0) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetId' Invalid Input for Key '%1', KeyField '%2' or Data '%3'", _key, _keyField, _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetId' Key: '%1', KeyField: '%2', Data: '%3'", _key, _keyField, _data]; +#endif + +if (_key == "" || _keyField == "" || count _data == 0) exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetId' Invalid Input for Key '%1', KeyField '%2' or Data '%3'", _key, _keyField, _data]; +}; "ArmaDragonflyClient" callExtension ["hsetid", [_key, _keyField, _data]]; \ No newline at end of file diff --git a/addons/db/functions/fnc_hashSetIdBulk.sqf b/addons/db/functions/fnc_hashSetIdBulk.sqf index 29e61f7..53c9082 100644 --- a/addons/db/functions/fnc_hashSetIdBulk.sqf +++ b/addons/db/functions/fnc_hashSetIdBulk.sqf @@ -30,6 +30,12 @@ params [["_data", [], [[]]]]; -if (count _data == 0) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetIdBulk' Invalid Input for Data '%1'", _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetIdBulk' Data: %1", _data]; +#endif + +if (count _data == 0) exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetIdBulk' Invalid Input for Data '%1'", _data]; +}; "ArmaDragonflyClient" callExtension ["hsetid", _data]; \ No newline at end of file diff --git a/addons/db/functions/fnc_listAdd.sqf b/addons/db/functions/fnc_listAdd.sqf index 279c00d..17931fa 100644 --- a/addons/db/functions/fnc_listAdd.sqf +++ b/addons/db/functions/fnc_listAdd.sqf @@ -31,6 +31,12 @@ params [["_key", "", [""]], ["_data", [], [[]]]]; -if (_key == "" || count _data == 0) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listAdd' Invalid Input for Key '%1' or Data '%2'", _key, _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listAdd' Key: '%1', Data: '%2'", _key, _data]; +#endif + +if (_key == "" || count _data == 0) exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listAdd' Invalid Input for Key '%1' or Data '%2'", _key, _data]; +}; "ArmaDragonflyClient" callExtension ["listadd", [_key, _data]]; \ No newline at end of file diff --git a/addons/db/functions/fnc_listGet.sqf b/addons/db/functions/fnc_listGet.sqf index 8639e88..a5e5748 100644 --- a/addons/db/functions/fnc_listGet.sqf +++ b/addons/db/functions/fnc_listGet.sqf @@ -32,19 +32,42 @@ * Public: Yes */ -params [["_key", "", [""]], ["_index", -1, [0]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", nil, [""]]]; +params [["_key", "", [""]], ["_index", -1, [0]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; -if (_key == "" || _function == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listGet' Invalid Input for Key '%1' or Function '%2'", _key, _function]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listGet' Key: '%1', Index: '%2', Function: '%3', Call: '%4', NetId: '%5'", _key, _index, _function, _call, _netId]; +#endif + +if (_key == "" || _function == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listGet' Invalid Input for Key '%1' or Function '%2'", _key, _function]; +}; + +private _return = ""; + +if (_netId != "") then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listGet' Using NetId: '%1'", _netId]; + #endif -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { if (_call) then { _return = "ArmaDragonflyClient" callExtension ["listidx", [_key, _index, _function, _netId, _call]]; - [(_return select 0)] call FUNC(scheduler); } else { _return = "ArmaDragonflyClient" callExtension ["listidx", [_key, _index, _function, _netId]]; - [(_return select 0)] call FUNC(scheduler); }; } else { - _return = "ArmaDragonflyClient" callExtension ["listidx", [_key, _index, _function]]; - [(_return select 0)] call FUNC(scheduler); -}; \ No newline at end of file + #ifdef __A3__DEBUG__ + diag_log text "ArmaDragonflyClient: 'dragonfly_db_fnc_listGet' Using current player"; + #endif + + if (_call) then { + _return = "ArmaDragonflyClient" callExtension ["listidx", [_key, _index, _function, _call]]; + } else { + _return = "ArmaDragonflyClient" callExtension ["listidx", [_key, _index, _function]]; + }; +}; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listGet' Return: '%1'", _return]; +#endif + +[(_return select 0)] call FUNC(scheduler); \ No newline at end of file diff --git a/addons/db/functions/fnc_listLoad.sqf b/addons/db/functions/fnc_listLoad.sqf index 85ba815..53795a3 100644 --- a/addons/db/functions/fnc_listLoad.sqf +++ b/addons/db/functions/fnc_listLoad.sqf @@ -31,19 +31,42 @@ * Public: Yes */ -params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", nil, [""]]]; +params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; -if (_key == "" || _function == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listLoad' Invalid Input for Key '%1' or Function '%2'", _key, _function]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listLoad' Key: '%1', Function: '%2', Call: '%3', NetId: '%4'", _key, _function, _call, _netId]; +#endif + +if (_key == "" || _function == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listLoad' Invalid Input for Key '%1' or Function '%2'", _key, _function]; +}; + +private _return = ""; + +if (_netId != "") then { + #ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listLoad' Using NetId: '%1'", _netId]; + #endif -if ((!isNil "_netId") and (_netId isNotEqualTo "")) then { if (_call) then { _return = "ArmaDragonflyClient" callExtension ["listrng", [_key, 0, -1, _function, _netId, _call]]; - [(_return select 0)] call FUNC(scheduler); } else { _return = "ArmaDragonflyClient" callExtension ["listrng", [_key, 0, -1, _function, _netId]]; - [(_return select 0)] call FUNC(scheduler); }; } else { - _return = "ArmaDragonflyClient" callExtension ["listrng", [_key, 0, -1, _function]]; - [(_return select 0)] call FUNC(scheduler); -}; \ No newline at end of file + #ifdef __A3__DEBUG__ + diag_log text "ArmaDragonflyClient: 'dragonfly_db_fnc_listLoad' Using current player"; + #endif + + if (_call) then { + _return = "ArmaDragonflyClient" callExtension ["listrng", [_key, 0, -1, _function, _call]]; + } else { + _return = "ArmaDragonflyClient" callExtension ["listrng", [_key, 0, -1, _function]]; + }; +}; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listLoad' Return: '%1'", _return]; +#endif + +[(_return select 0)] call FUNC(scheduler); \ No newline at end of file diff --git a/addons/db/functions/fnc_listRemove.sqf b/addons/db/functions/fnc_listRemove.sqf index 9c1ee41..be4f654 100644 --- a/addons/db/functions/fnc_listRemove.sqf +++ b/addons/db/functions/fnc_listRemove.sqf @@ -31,6 +31,12 @@ params [["_key", "", [""]], ["_index", -1, [0]]]; -if (_key == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listRemove' Invalid Input for Key '%1'", _key]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listRemove' Key: '%1', Index: '%2'", _key, _index]; +#endif + +if (_key == "") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listRemove' Invalid Input for Key '%1'", _key]; +}; "ArmaDragonflyClient" callExtension ["listrem", [_key, _index]]; \ No newline at end of file diff --git a/addons/db/functions/fnc_listSet.sqf b/addons/db/functions/fnc_listSet.sqf index e332158..c0b1db5 100644 --- a/addons/db/functions/fnc_listSet.sqf +++ b/addons/db/functions/fnc_listSet.sqf @@ -32,6 +32,12 @@ params [["_key", "", [""]], ["_index", -1, [0]], ["_data", [], [[]]]]; -if (_key == "" || count _data == 0) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listSet' Invalid Input for Key '%1' or Data '%2'", _key, _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listSet' Key: '%1', Index: '%2', Data: '%3'", _key, _index, _data]; +#endif + +if (_key == "" || count _data == 0) exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listSet' Invalid Input for Key '%1' or Data '%2'", _key, _data]; +}; "ArmaDragonflyClient" callExtension ["listset", [_key, _index, _data]]; \ No newline at end of file diff --git a/addons/db/functions/fnc_pubSubFetch.sqf b/addons/db/functions/fnc_pubSubFetch.sqf index e578723..d4b8f9c 100644 --- a/addons/db/functions/fnc_pubSubFetch.sqf +++ b/addons/db/functions/fnc_pubSubFetch.sqf @@ -20,7 +20,9 @@ ["uniqueID", "evetnType", "eventName", "index", "indextotal", "datachunk", "target"] */ -diag_log _this; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubFetch' Data: %1", _this]; +#endif params ["_uniqueID", "_eventType", "_eventName", "_index", "_total", "_datachunk", "_target"]; diff --git a/addons/db/functions/fnc_pubSubHandler.sqf b/addons/db/functions/fnc_pubSubHandler.sqf index 7f02328..2b013db 100644 --- a/addons/db/functions/fnc_pubSubHandler.sqf +++ b/addons/db/functions/fnc_pubSubHandler.sqf @@ -34,6 +34,10 @@ params [["_uniqueID", "", [""]], ["_eventType", "", [""]], ["_eventName", "", [""]], ["_data", [], [[]]], ["_target", "", [""]]]; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubHandler' Data: %1", _this]; +#endif + switch (_eventType) do { case "global": { [_eventName, _data] call CFUNC(globalEvent); diff --git a/addons/db/functions/fnc_publish.sqf b/addons/db/functions/fnc_publish.sqf index 3b848a2..62be3d3 100644 --- a/addons/db/functions/fnc_publish.sqf +++ b/addons/db/functions/fnc_publish.sqf @@ -30,10 +30,11 @@ * Public: Yes */ -params [ - ["_channel", "", [""]], - ["_message", [], [[], "", 0, true]] -]; +params [["_channel", "", [""]], ["_message", [], [[], "", 0, true]]]; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_publish' Channel: '%1', Message: '%2'", _channel, _message]; +#endif if (_channel isEqualTo "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_publish' Invalid Input for Channel '%1'", _channel]; diff --git a/addons/db/functions/fnc_set.sqf b/addons/db/functions/fnc_set.sqf index 91ccfef..d659610 100644 --- a/addons/db/functions/fnc_set.sqf +++ b/addons/db/functions/fnc_set.sqf @@ -31,6 +31,12 @@ params [["_key", "", [""]], ["_data", "", [[]]]]; -if (_key == "" || _data == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_set' Invalid Input for Key '%1' or Data '%2'", _key, _data]; }; +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_set' Key: '%1', Data: '%2'", _key, _data]; +#endif + +if (_key == "" || isNil "_data") exitWith { + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_set' Invalid Input for Key '%1' or Data '%2'", _key, _data]; +}; "ArmaDragonflyClient" callExtension ["set", [_key, _data]]; \ No newline at end of file diff --git a/addons/db/functions/fnc_subscribe.sqf b/addons/db/functions/fnc_subscribe.sqf index a961e33..ea5f7a1 100644 --- a/addons/db/functions/fnc_subscribe.sqf +++ b/addons/db/functions/fnc_subscribe.sqf @@ -32,12 +32,11 @@ * Public: Yes */ -params [ - ["_channel", "", [""]], - ["_eventType", "global", [""]], - ["_eventName", "", [""]], - ["_target", nil, [""]] -]; +params [["_channel", "", [""]], ["_eventType", "global", [""]], ["_eventName", "", [""]], ["_target", nil, [""]]]; + +#ifdef __A3__DEBUG__ + diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Channel: '%1', Event Type: '%2', Event Name: '%3', Target: '%4'", _channel, _eventType, _eventName, _target]; +#endif if (_channel isEqualTo "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Invalid Input for Channel '%1'", _channel]; diff --git a/addons/db/functions/fnc_test.sqf b/addons/db/functions/fnc_test.sqf index c24579a..1ea2cd2 100644 --- a/addons/db/functions/fnc_test.sqf +++ b/addons/db/functions/fnc_test.sqf @@ -32,4 +32,4 @@ _res = _this; dragonfly_db_test = _res; hint format ["%1", _res]; -diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_test' Result: %1", _res]; \ No newline at end of file +diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_test' Result: '%1'", _res]; \ No newline at end of file