-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allign CBA debug/warning/error messages to ACE versions
- Loading branch information
Showing
13 changed files
with
154 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ class CfgPatches { | |
#include "CfgEventHandlers.hpp" | ||
|
||
#include "CfgDisplay3DEN.hpp" | ||
#include "gui.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,59 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_error | ||
Internal Function: CBA_fnc_error | ||
Description: | ||
Logs an error message to the RPT log. | ||
Should not be used directly, but rather via macros (<ERROR()>, | ||
<ERROR_WITH_TITLE()> or the <Assertions>). | ||
Should not be used directly, but rather via macros (<ERROR_WITH_TITLE()> | ||
or the <Assertions>). | ||
Parameters: | ||
_file - Name of file [String] | ||
_lineNum - Line of file (starting at 0) [Number] | ||
_title - Title of the error [String] | ||
_message - Error message [String, which may contain \n] | ||
_prefix - Addon name (optional, defaut: "cba") <STRING> | ||
_component - Component name (optional, default: "diagnostic") <STRING> | ||
_title - Title of the error <STRING> | ||
_message - Error message (use "\n" for newline) <STRING> | ||
_file - Name of file <STRING> | ||
_lineNum - Line of file <NUMEBR> | ||
Returns: | ||
nil | ||
Author: | ||
Spooner | ||
Spooner, commy2 | ||
---------------------------------------------------------------------------- */ | ||
|
||
#include "script_component.hpp" | ||
|
||
SCRIPT(error); | ||
|
||
// ----------------------------------------------------------------------------- | ||
params ["_file","_lineNum","_title","_message"]; | ||
|
||
private ["_time", "_lines"]; | ||
params [ | ||
["_prefix", 'PREFIX', [""]], | ||
["_component", 'COMPONENT'], | ||
["_title", "", [""]], | ||
["_message", "", [""]], | ||
["_file", "", [""]], | ||
["_lineNum", -1, [0]] | ||
]; | ||
|
||
// TODO: popup window with error message in it. | ||
_time = [diag_tickTime, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime; | ||
_prefix = toUpper _prefix; | ||
|
||
diag_log text format ["%1 (%2) [%3:%4] -ERROR- %5", _time, time, _file, _lineNum + 1, _title]; | ||
// RPT log | ||
diag_log text format ["[%1] (%2) ERROR: %3 File: %4 Line: %5", _prefix, _component, _title, _file, _lineNum]; | ||
|
||
_lines = [_message, "\n"] call CBA_fnc_split; | ||
private _lines = [_message, "\n"] call CBA_fnc_split; | ||
|
||
{ | ||
diag_log text format [" %1", _x]; | ||
} forEach _lines; | ||
|
||
nil; | ||
// error pop up | ||
QGVAR(Error) cutRsc [QGVAR(Error), "PLAIN"]; | ||
private _control = uiNamespace getVariable QGVAR(Error); | ||
|
||
private _compose = [lineBreak, parseText format ["<t align='center' size='1.65'>[%1] (%2) %3<\t>", _prefix, _component, _title], lineBreak]; | ||
|
||
{ | ||
_compose append [lineBreak, format [" %1", _x]]; | ||
} forEach _lines; | ||
|
||
_control ctrlSetStructuredText composeText _compose; | ||
|
||
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,45 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_log | ||
Internal Function: CBA_fnc_log | ||
Description: | ||
Logs a message to the RPT log. | ||
Should not be used directly, but rather via macro (<LOG()>). | ||
This function is unaffected by the debug level (<DEBUG_MODE_x>). | ||
Parameters: | ||
_file - File error occurred in [String] | ||
_lineNum - Line number error occurred on (starting from 0) [Number] | ||
_message - Message [String] | ||
_message - Message <STRING> | ||
Returns: | ||
nil | ||
Author: | ||
Spooner and Rommel | ||
Spooner, Rommel, commy2 | ||
-----------------------------------------------------------------------------*/ | ||
#define DEBUG_MODE_NORMAL | ||
#include "script_component.hpp" | ||
|
||
SCRIPT(log); | ||
|
||
// ---------------------------------------------------------------------------- | ||
params [["_message", "", [""]]]; | ||
|
||
if (isNil QGVAR(logArray)) then { | ||
GVAR(logArray) = []; | ||
GVAR(logScript) = scriptNull; | ||
}; | ||
|
||
#ifndef DEBUG_SYNCHRONOUS | ||
if (isNil "CBA_LOG_ARRAY") then { CBA_LOG_ARRAY = [] }; | ||
private ["_msg"]; | ||
_msg = [_this select 0, _this select 1, _this select 2, diag_frameNo, diag_tickTime, time]; // Save it here because we want to know when it was happening, not when it is outputted | ||
CBA_LOG_ARRAY pushBack _msg; | ||
GVAR(logArray) pushBack text _message; | ||
|
||
if (isNil "CBA_LOG_VAR") then | ||
{ | ||
CBA_LOG_VAR = true; | ||
SLX_XEH_STR spawn | ||
{ | ||
_fnc_log = | ||
{ | ||
params ["_file","_lineNum","_message","_frameNo","_tickTime","_gameTime"]; | ||
// TODO: Add log message to trace log | ||
diag_log [_frameNo, | ||
_tickTime, _gameTime, //[_tickTime, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime, [_gameTime, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime, | ||
_file + ":"+str(_lineNum + 1), _message]; | ||
}; | ||
if (scriptDone GVAR(logScript)) then { | ||
GVAR(logScript) = 0 spawn { | ||
private "_selected"; | ||
|
||
_selected = ""; | ||
while {_selected = CBA_LOG_ARRAY deleteAt 0; !isNil "_selected"} do | ||
{ | ||
_selected call _fnc_log; | ||
}; | ||
CBA_LOG_VAR = nil; | ||
while { | ||
_selected = GVAR(logArray) deleteAt 0; | ||
!isNil "_selected" | ||
} do { | ||
diag_log _selected; | ||
}; | ||
}; | ||
#else | ||
params ["_file","_lineNum","_message"]; | ||
// TODO: Add log message to trace log | ||
diag_log [diag_frameNo, | ||
diag_tickTime, time, // [diag_tickTime, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime, [time, "H:MM:SS.mmm"] call CBA_fnc_formatElapsedTime | ||
_file + ":"+str(_lineNum + 1), _message]; | ||
#endif | ||
}; | ||
|
||
nil; | ||
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
class RscStructuredText; | ||
|
||
class RscTitles { | ||
class GVAR(Error) { | ||
idd = -1; | ||
duration = 5; | ||
fadeIn = 0; | ||
fadeOut = 0.5; | ||
movingEnable = 0; | ||
|
||
class Controls { | ||
class GVAR(Error): RscStructuredText { | ||
onLoad = QUOTE(uiNamespace setVariable [ARR_2('GVAR(Error)',_this select 0)]); | ||
idc = -1; | ||
font = "RobotoCondensedBold"; | ||
sizeEx = 0.55 * GUI_GRID_CENTER_H; | ||
x = 0 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; | ||
y = 0 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; | ||
w = 40 * GUI_GRID_CENTER_W; | ||
h = 10 * GUI_GRID_CENTER_H; | ||
colorBackground[] = {1,0.4,0,0.8}; | ||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.