Example #1
0
    ///<summary>
    /// Display a message in the CLI.
    ///</summary>
    ///<param name="_line">The text to display</param>
    ///<param name="_color">The color of the text. Default is white</param>
    public void AppendLogLine(string _line, bool _writeInCli, eLogtype _type = eLogtype.info)
    {
        if (!writeLogs)
        {
            return;
        }

        // Legacy build-in CLI
        string color = "";

        if (_type == eLogtype.info)
        {
            color = "white";
        }
        else if (_type == eLogtype.success)
        {
            color = "green";
        }
        else if (_type == eLogtype.warning)
        {
            color = "yellow";
        }
        else if (_type == eLogtype.error)
        {
            color = "red";
        }
        consoleController.AppendLogLine(_line, color);

        // Remote CLI
        if (_writeInCli)
        {
            try
            {
                server.Send(_line);
            }
            catch (System.Exception e)
            {
                Debug.LogError(e.Message);
            }
        }

        WriteLogFile(_line, _type);
        switch (_type)
        {
        case eLogtype.warning:
            Debug.LogWarning(_line);
            break;

        case eLogtype.error:
            Debug.LogError(_line);
            break;

        default:
            Debug.Log(_line);
            break;
        }
    }