Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
logtemplates.c
Go to the documentation of this file.
2 typedef int LogTemplateID;
3 
4 /*
5  * OBSOLETE: kept for possible backward compatibility only
6  */
8 {
9  static private ref map<LogTemplateID, ref LogTemplate> m_LogTemplates;
10 
11  static private void RegisterLogTamplate(LogTemplateID template_id, string author, string plugin, string label)
12  {
13  if ( m_LogTemplates == NULL )
14  {
15  m_LogTemplates = new map<LogTemplateID, ref LogTemplate>;
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
35  static LogTemplateID TEMPLATE_UNKNOWN = 0;
36  static LogTemplateID TEMPLATE_JANOSIK = 1;
37  static LogTemplateID TEMPLATE_PLAYER_WEIGHT = 2;
38  static LogTemplateID TEMPLATE_BROADCAST = 3;
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 
52  static LogTemplate GetTemplate(LogTemplateID template_id)
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 
75 void Log(string message, LogTemplateID template_id = 0)
76 {
77  LogTemplate log_template = LogTemplates.GetTemplate(template_id);
78 
79  Debug.Log(message, log_template.param2, log_template.param1, log_template.param3);
80 }
81 
93 void 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 
111 void 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 
129 void 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 
136 void SQFPrint(string sqf_msg)
137 {
138  Print(sqf_msg);
139 }
140 
141 void SQFLog(string sqf_msg)
142 {
143  Log(sqf_msg);
144 }
LogError
void LogError(string message, LogTemplateID template_id=0)
Creates error log (optional) from LogTemplate which are registred.
Definition: logtemplates.c:129
SQFLog
void SQFLog(string sqf_msg)
Definition: logtemplates.c:141
LogInfo
void LogInfo(string message, LogTemplateID template_id=0)
Creates info log (optional) from LogTemplate which are registred.
Definition: logtemplates.c:93
Log
class LogTemplates Log(string message, LogTemplateID template_id=0)
Creates debug log (optional) from LogTemplate which are registred.
Definition: logtemplates.c:75
Print
proto void Print(void var)
Prints content of variable to console/log.
LogTemplate
Param3< string, string, string > LogTemplate
Definition: logtemplates.c:1
LogWarning
void LogWarning(string message, LogTemplateID template_id=0)
Creates warning log (optional) from LogTemplate which are registred.
Definition: logtemplates.c:111
SQFPrint
void SQFPrint(string sqf_msg)
Definition: logtemplates.c:136
Param3
Definition: entityai.c:95
ToString
proto string ToString()
map
map
Definition: controlsxboxnew.c:3
LogTemplateID
int LogTemplateID
Definition: logtemplates.c:2
Debug
Definition: debug.c:13
LogTemplates
Definition: logtemplates.c:7