Esempio n. 1
0
    //Save log file
    public void saveRecorder()
    {
        System.DateTime dt      = System.DateTime.Now;
        int             hour    = dt.Hour;
        int             minutes = dt.Minute;
        int             sec     = dt.Second;

        if (!System.IO.Directory.Exists("log"))
        {
            System.IO.Directory.CreateDirectory("log");
        }


        string logFileName = hour.ToString() + "-" + minutes.ToString() + "-" + sec.ToString() + "_" + prefix + ".logged";

        string contents = "";


        foreach (float key in recordedLoggingData.Keys)
        {
            List <LogTimeData> loggedList = recordedLoggingData[key];



            for (int i = 0; i < loggedList.Count; i++)
            {
                string timeInfo = key.ToString();
                string logName  = loggedList[i].logFormat.name;
                string logValue = GlobalLogger.returnByType(loggedList[i].logFormat);

                contents = contents + timeInfo + "," + logName + "," + logValue + "\n";
            }
        }


        System.IO.File.WriteAllText(System.IO.Path.Combine("log", logFileName), contents);
    }