Slide 41
Slide 41 text
void Init()
{
string path = Path.Combine(Application.dataPath, Guid.NewGuid().ToString("N") + ".log");
var stream = new FileStream(path, FileMode.CreateNew, FileAccess.Write);
mLogFileWriter = new StreamWriter(stream, System.Text.Encoding.UTF8);
mLogFileWriter.AutoFlush = true;
Application.logMessageReceived += LogCallback;
GameLiftServerAPI.ProcessReady(new ProcessParameters()
{
(省略)
LogParameters = new LogParameters(new List() { path })
});
}
void LogCallback(string condition, string stackTrace, LogType type)
{
mLogFileWriter.WriteLine($"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")},{type.ToString()},{condition}");
}
(C) mixi, Inc. All rights reserved.
41
実装例