|
typedef Param3<string, string, string> LogTemplate; |
|
typedef int LogTemplateID; |
|
|
|
|
|
|
|
|
|
class LogTemplates |
|
{ |
|
static private ref map<LogTemplateID, ref LogTemplate> m_LogTemplates; |
|
|
|
static private void RegisterLogTamplate(LogTemplateID template_id, string author, string plugin, string label) |
|
{ |
|
if ( m_LogTemplates == NULL ) |
|
{ |
|
m_LogTemplates = new map<LogTemplateID, ref LogTemplate>; |
|
} |
|
|
|
if ( m_LogTemplates.Contains(template_id) ) |
|
{ |
|
Debug.Log("Template ID: "+string.ToString(template_id)+" is alredy exist!", "LogTemplate.h -> OnInit()", "System", "Template Registration", "None"); |
|
} |
|
else |
|
{ |
|
LogTemplate params = new LogTemplate(author, plugin, label); |
|
m_LogTemplates.Set(template_id, params); |
|
} |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LogTemplateID TEMPLATE_UNKNOWN = 0; |
|
static LogTemplateID TEMPLATE_JANOSIK = 1; |
|
static LogTemplateID TEMPLATE_PLAYER_WEIGHT = 2; |
|
static LogTemplateID TEMPLATE_BROADCAST = 3; |
|
|
|
static void Init() |
|
{ |
|
|
|
|
|
|
|
RegisterLogTamplate( TEMPLATE_UNKNOWN ,"Unknown" ,"Unknown" ,"Unknown" ); |
|
RegisterLogTamplate( TEMPLATE_JANOSIK ,"Janosik" ,"GUI" ,"None" ); |
|
RegisterLogTamplate( TEMPLATE_PLAYER_WEIGHT ,"Unknown" ,"PlayerBase" ,"Weight" ); |
|
RegisterLogTamplate( TEMPLATE_BROADCAST ,"Unknown" ,"PluginMessageManager" ,"Broadcast" ); |
|
|
|
} |
|
|
|
static LogTemplate GetTemplate(LogTemplateID template_id) |
|
{ |
|
if ( m_LogTemplates && m_LogTemplates.Contains(template_id) ) |
|
{ |
|
return m_LogTemplates.Get(template_id); |
|
} |
|
|
|
Debug.Log("Template ID: "+string.ToString(template_id)+" does not exist!", "LogTemplate.h -> GetTemplate()", "System", "Get Log Template", "None"); |
|
return NULL; |
|
} |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Log(string message, LogTemplateID template_id = 0) |
|
{ |
|
LogTemplate log_template = LogTemplates.GetTemplate(template_id); |
|
|
|
Debug.Log(message, log_template.param2, log_template.param1, log_template.param3); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LogInfo(string message, LogTemplateID template_id = 0) |
|
{ |
|
LogTemplate log_template = LogTemplates.GetTemplate(template_id); |
|
|
|
Debug.LogInfo(message, log_template.param2, log_template.param1, log_template.param3); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LogWarning(string message, LogTemplateID template_id = 0) |
|
{ |
|
LogTemplate log_template = LogTemplates.GetTemplate(template_id); |
|
|
|
Debug.LogWarning(message, log_template.param2, log_template.param1, log_template.param3); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LogError(string message, LogTemplateID template_id = 0) |
|
{ |
|
LogTemplate log_template = LogTemplates.GetTemplate(template_id); |
|
|
|
Debug.LogError(message, log_template.param2, log_template.param1, log_template.param3); |
|
} |
|
|
|
void SQFPrint(string sqf_msg) |
|
{ |
|
Print(sqf_msg); |
|
} |
|
|
|
void SQFLog(string sqf_msg) |
|
{ |
|
Log(sqf_msg); |
|
} |