Esempio n. 1
0
        /// <summary>
        /// Standard log method for submitting general log messages that are formatted before displaying.
        /// </summary>
        /// <param name="message">Message to embed into log report</param>
        internal static void logMessageToUnityConsole(string message, SerializerLogType logType)
        {
            if (displayEventMessages == false)
            {
                return;
            }

            string output = "Deployment Serializer Log Message: \n" +
                            "---------------------------------------------- \n" +
                            message + "\n" +
                            "----------------------------------------------";

            Debug.Log(output);
        }
Esempio n. 2
0
        /// <summary>
        /// Appends a log message to the log file
        /// </summary>
        /// <param name="message">Contents of message to be formatted for the log</param>
        /// <param name="logType">Message type for log to be catagorized by</param>
        internal static void logMessageToBuildFile(string message, SerializerLogType logType)
        {
            if (logMessagesInBuild == false)
            {
                return;
            }


            string output = "";

            //Add correct header for log type
            switch (logType)
            {
            case SerializerLogType.Standard:
                output += "DS_LogMessage:\n";
                break;

            case SerializerLogType.Warning:
                output += "DS_Warning:\n";
                break;

            case SerializerLogType.Error:
                output += "DS_Error:\n";
                break;
            }

            //Format message
            output += "---------------------------------------------- \n"
                      + message + "\n" +
                      "---------------------------------------------- \n" +
                      "~ \n";

            //Nest file modification in try/catch to prevent IO based crashing
            try
            {
                //Append the new log to the file, creates file if it doesn't exist
                File.AppendAllText(buildLogFilePath, output);
            }
            catch (IOException)
            {
                logMessageToUnityConsole("Deployment Serializer failed to append to the log file!", SerializerLogType.Error);
            }
        }