DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
LogTemplates.c
Go to the documentation of this file.
1typedef Param3<string, string, string> LogTemplate;
2typedef int LogTemplateID;
3
4/*
5 * OBSOLETE: kept for possible backward compatibility only
6 */
8{
10
11 static private void RegisterLogTamplate(LogTemplateID template_id, string author, string plugin, string label)
12 {
13 if ( m_LogTemplates == NULL )
14 {
16 }
17
18 if ( m_LogTemplates.Contains(template_id) )
19 {
20 Debug.Log("Template ID: "+string.ToString(template_id)+" is alredy exist!", "LogTemplate.h -> OnInit()", "System", "Template Registration", "None");
21 }
22 else
23 {
24 LogTemplate params = new LogTemplate(author, plugin, label);
25 m_LogTemplates.Set(template_id, params);
26 }
27 }
28
29 // Steps to register of new log template:
30 // 1.) Crete new LogTemplateID in below of this comment.
31 // 2.) Set Template Name in format TEMPLATE_[CUSTOM NAME] => TEMPLATE_MY_LOG
32 // 3.) Set Template ID which is your id + your custom id => + CustomID(0) = 50190
34 // Template Name Template ID
39
40 static void Init()
41 {
44 // | Template Name | author | plugin | label ////
45 RegisterLogTamplate( TEMPLATE_UNKNOWN ,"Unknown" ,"Unknown" ,"Unknown" );//
46 RegisterLogTamplate( TEMPLATE_JANOSIK ,"Janosik" ,"GUI" ,"None" );//
47 RegisterLogTamplate( TEMPLATE_PLAYER_WEIGHT ,"Unknown" ,"PlayerBase" ,"Weight" );//
48 RegisterLogTamplate( TEMPLATE_BROADCAST ,"Unknown" ,"PluginMessageManager" ,"Broadcast" );//
49
50 }
51
53 {
54 if ( m_LogTemplates && m_LogTemplates.Contains(template_id) )
55 {
56 return m_LogTemplates.Get(template_id);
57 }
58
59 Debug.Log("Template ID: "+string.ToString(template_id)+" does not exist!", "LogTemplate.h -> GetTemplate()", "System", "Get Log Template", "None");
60 return NULL;
61 }
62}
63
75void Log(string message, LogTemplateID template_id = 0)
77 LogTemplate log_template = LogTemplates.GetTemplate(template_id);
79 Debug.Log(message, log_template.param2, log_template.param1, log_template.param3);
80}
81
93void LogInfo(string message, LogTemplateID template_id = 0)
94{
95 LogTemplate log_template = LogTemplates.GetTemplate(template_id);
96
97 Debug.LogInfo(message, log_template.param2, log_template.param1, log_template.param3);
98}
99
111void LogWarning(string message, LogTemplateID template_id = 0)
112{
113 LogTemplate log_template = LogTemplates.GetTemplate(template_id);
114
115 Debug.LogWarning(message, log_template.param2, log_template.param1, log_template.param3);
116}
117
129void LogError(string message, LogTemplateID template_id = 0)
130{
131 LogTemplate log_template = LogTemplates.GetTemplate(template_id);
132
133 Debug.LogError(message, log_template.param2, log_template.param1, log_template.param3);
134}
135
136void SQFPrint(string sqf_msg)
137{
138 Print(sqf_msg);
139}
140
141void SQFLog(string sqf_msg)
142{
143 Log(sqf_msg);
144}
proto string ToString()
void LogInfo(string message, LogTemplateID template_id=0)
Creates info log (optional) from LogTemplate which are registred.
Param3< string, string, string > LogTemplate
Definition LogTemplates.c:1
void LogWarning(string message, LogTemplateID template_id=0)
Creates warning log (optional) from LogTemplate which are registred.
int LogTemplateID
Definition LogTemplates.c:2
void SQFPrint(string sqf_msg)
void SQFLog(string sqf_msg)
class LogTemplates Log(string message, LogTemplateID template_id=0)
Creates debug log (optional) from LogTemplate which are registred.
void LogError(string message, LogTemplateID template_id=0)
Creates error log (optional) from LogTemplate which are registred.
Definition Debug.c:14
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:235
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
static void LogInfo(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:205
static void LogWarning(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as warning message.
Definition Debug.c:220
static void Init()
static private ref map< LogTemplateID, ref LogTemplate > m_LogTemplates
Definition LogTemplates.c:9
static LogTemplateID TEMPLATE_UNKNOWN
static LogTemplateID TEMPLATE_JANOSIK
static LogTemplate GetTemplate(LogTemplateID template_id)
static private void RegisterLogTamplate(LogTemplateID template_id, string author, string plugin, string label)
static LogTemplateID TEMPLATE_PLAYER_WEIGHT
static LogTemplateID TEMPLATE_BROADCAST
proto void Print(void var)
Prints content of variable to console/log.