28 lines
661 B
Plaintext
28 lines
661 B
Plaintext
/*
|
|
Function: milsim_fnc_log
|
|
|
|
Description:
|
|
Used to log messages to the server RPT file.
|
|
|
|
Parameters:
|
|
0: STRING - component name.
|
|
1: STRING - message to log.
|
|
2: ARRAY - Key value pairs of data to log.
|
|
*/
|
|
|
|
params [
|
|
["_component", "", [""]],
|
|
["_message", "", [""]],
|
|
["_data", [], [[]]]
|
|
];
|
|
|
|
private _hash = createHashMapFromArray _data;
|
|
|
|
// Replace square brackets with round brackets to avoid parsing issues.
|
|
_message regexReplace ["\[", "("];
|
|
_message regexReplace ["\]", ")"];
|
|
|
|
private _json = [_hash] call CBA_fnc_encodeJSON;
|
|
_log = format ["[milsim] [%1] [%2] [%3] :: %4", _component, _fnc_scriptNameParent, _message, _json];
|
|
|
|
diag_log text _log; |