Exemplo n.º 1
0
        public static void Log <T>(this ILogPlayer <T> player, LogLevel logLevel, int eventId, Exception exception, string message)
            where T : class
        {
            switch (logLevel)
            {
            case LogLevel.Trace:
                player.Logger.LogTrace(eventId, exception, message);
                break;

            case LogLevel.Debug:
                player.Logger.LogDebug(eventId, exception, message);
                break;

            case LogLevel.Information:
                player.Logger.LogInformation(eventId, exception, message);
                break;

            case LogLevel.Warning:
                player.Logger.LogWarning(eventId, exception, message);
                break;

            case LogLevel.Error:
                player.Logger.LogError(eventId, exception, message);
                break;

            case LogLevel.Critical:
                player.Logger.LogCritical(eventId, exception, message);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null);
            }
        }
        /// <summary>
        /// This is called when the Unity application starts. It is used for initialization of the current state.
        /// </summary>
        public void Start()
        {
            bool isRunningInEditor = Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor;

            _logPlayer   = !isRunningInEditor ? (ILogPlayer) new UnusedLogFilePlayer() : new MockLogFilePlayer();
            _logRecorder = new BluetoothLogRecorder {
                IsEnabled = false
            };
        }