Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
logtemplates.c
Go to the documentation of this file.
2typedef 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
75void 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
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}
Definition debug.c:2
proto string ToString()
proto void Print(void var)
Prints content of variable to console/log.
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.