BIS fnc logFormat: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Created page with "<syntaxhighlight lang=javascript>/* Author: Karel Moricky Description: Display debug message Parameter(s): _this select 0: STRING - Formatted message or first param _this...")
Line 1: Line 1:
 
<syntaxhighlight lang=javascript>/*
{{Function|= Comments
Author: Karel Moricky
____________________________________________________________________________________________
 
| arma3 |= Game name
 
|1.00|= Game version
____________________________________________________________________________________________
 
| <pre>/*


Description:
Description:
Line 21: Line 13:
*/
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
private["_omit"];
____________________________________________________________________________________________
 
| <!-- [] call [[BIS_fnc_logFormat]]; --> |= Syntax


|p1= |= Parameter 1
if (isNil "_fnc_log_disable") then
{
_omit = false;
}
else
{
_omit = _fnc_log_disable;
};


| |= Return value
if (_omit) exitWith {false};
____________________________________________________________________________________________


|x1= <code></code> |=
private ["_scriptName","_text"];
____________________________________________________________________________________________


| |= See also
//--- Insert function name where available
_scriptName = if (isnil "_fnc_scriptName"/* || isnil "_fnc_scriptNameParent"*/) then {
""
} else {
_fnc_scriptName
};
_scriptName = if (_scriptName != "") then {" [" + _scriptName + "] "} else {" "};


}}


<h3 style="display:none">Notes</h3>
//--- Display
<dl class="command_description">
if (typename _this != typename []) then {_this = [_this]};
<!-- Note Section BEGIN -->
if (count _this == 0) then {_this = ["<EMPTY ARRAY>"]};
_text = _this select 0;
if (typename _text != typename "") then {_text = str _this;};
_thisLocal = +_this;
_thisLocal set [0,profilename + "/BIS_fnc_log:" + _scriptName + _text];


<!-- Note Section END -->
if (getnumber (missionconfigfile >> "allowFunctionsLog") > 0 || cheatsEnabled) then {
</dl>
diag_log format _thisLocal
};


<h3 style="display:none">Bottom Section</h3>
true
[[Category:Function Group: Debug|{{uc:logFormat}}]]
</syntaxhighlight>
[[Category:Functions|{{uc:logFormat}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:logFormat}}]]

Revision as of 00:41, 7 November 2013

/*
	Author: Karel Moricky

	Description:
	Display debug message

	Parameter(s):
	_this select 0: STRING - Formatted message or first param
	_this select n (Optional): ANY - additional parameters

	Returns:
	BOOL - true when done
*/

private["_omit"];

if (isNil "_fnc_log_disable") then 
{
	_omit = false;
}
else
{
	_omit = _fnc_log_disable;
};

if (_omit) exitWith {false};

private ["_scriptName","_text"];

//--- Insert function name where available
_scriptName = if (isnil "_fnc_scriptName"/* || isnil "_fnc_scriptNameParent"*/) then {
	""
} else {
	_fnc_scriptName
};
_scriptName = if (_scriptName != "") then {" [" + _scriptName + "] "} else {" "};


//--- Display
if (typename _this != typename []) then {_this = [_this]};
if (count _this == 0) then {_this = ["<EMPTY ARRAY>"]};
_text = _this select 0;
if (typename _text != typename "") then {_text = str _this;};
_thisLocal = +_this;
_thisLocal set [0,profilename + "/BIS_fnc_log:" + _scriptName + _text];

if (getnumber (missionconfigfile >> "allowFunctionsLog") > 0 || cheatsEnabled) then {
	diag_log format _thisLocal
};

true