5 const string logFileName =
"$logs:ai_script.log";
9 protected ref FileHandle m_FileHandle;
19 override void OnGameStart()
24 m_FileHandle = FileIO.OpenFile(logFileName, FileMode.WRITE);
26 Print(
"SCR_AIDebug: Failed to create log file", LogLevel.ERROR);
31 override void OnGameEnd()
54 return behavior.Type().ToString();
62 static void DebugLog(
string str, LogLevel logLevel = LogLevel.DEBUG)
66 if(!inst.m_FileHandle)
70 bool copyToStdLog =
false;
74 case LogLevel.SPAM: logLevelStr =
"S";
break;
75 case LogLevel.VERBOSE: logLevelStr =
"v";
break;
76 case LogLevel.DEBUG: logLevelStr =
"D";
break;
77 case LogLevel.NORMAL: logLevelStr =
"N";
break;
78 case LogLevel.WARNING: logLevelStr =
"W"; copyToStdLog =
true;
break;
79 case LogLevel.ERROR: logLevelStr =
"E"; copyToStdLog =
true;
break;
80 case LogLevel.FATAL: logLevelStr =
"F"; copyToStdLog =
true;
break;
85 System.GetHourMinuteSecond(hr, min, sec);
86 int ticks = System.GetTickCount();
89 string formattedStr =
string.Format(
90 "%1:%2:%3 %4 (%5): %6",
99 inst.m_FileHandle.Write(formattedStr);
100 inst.m_FileHandle.Write(
"\n");
103 Print(str, logLevel);