Exemplo n.º 1
0
        public void Log(LocalChannel channel, string logText, LocalChannelLogEntryType type, string additionalData = "")
        {
            var entry = new LocalChannelLogEntry
            {
                Timestamp          = DateTime.Now,
                EntryType          = type,
                ChannelId          = channel != null && channel.Id != 0 ? channel.Id : (int?)null,
                TemporaryChannelId = channel?.TemporaryChannelId,
                ChannelData        = channel?.ToString(),
                State          = channel?.State,
                LogText        = logText,
                DebugData      = GetDebugData(),
                AdditionalData = additionalData
            };

            string channelData = channel != null?channel.ToString() : "";

            _logger.LogDebug($"{type}: {logText}. AdditionalData: {additionalData}. Channel: {channelData}");
            Save(entry);
        }
Exemplo n.º 2
0
        public void LogError(LocalChannel channel, LocalChannelError error, string errorText, string additionalData = "")
        {
            var entry = new LocalChannelLogEntry
            {
                Timestamp          = DateTime.Now,
                EntryType          = LocalChannelLogEntryType.Error,
                ChannelId          = channel != null && channel.Id != 0 ? channel.Id : (int?)null,
                TemporaryChannelId = channel?.TemporaryChannelId,
                ChannelData        = channel?.ToString(),
                State          = channel?.State,
                Error          = error,
                ErrorText      = errorText,
                DebugData      = GetDebugData(),
                AdditionalData = additionalData
            };

            string channelData = channel != null?channel.ToString() : "";

            _logger.LogError($"{error}: {errorText}. AdditionalData: {additionalData}. Channel: {channelData}");
            Save(entry);
        }
Exemplo n.º 3
0
        public void LogStateUpdate(LocalChannel channel, LocalChannelState oldState, string logText = "", string additionalData = "")
        {
            var entry = new LocalChannelLogEntry
            {
                Timestamp          = DateTime.Now,
                EntryType          = LocalChannelLogEntryType.StateUpdate,
                ChannelId          = channel != null && channel.Id != 0 ? channel.Id : (int?)null,
                TemporaryChannelId = channel?.TemporaryChannelId,
                ChannelData        = channel?.ToString(),
                State          = channel?.State,
                OldState       = oldState,
                LogText        = logText,
                DebugData      = GetDebugData(),
                AdditionalData = additionalData
            };

            string channelData = channel != null?channel.ToString() : "";

            string newState = channel != null?channel.State.ToString() : "";

            _logger.LogDebug($"Channel state update. New state: {newState}. Old state: {oldState}. {logText}. " +
                             $"AdditionalData: {additionalData}. Channel: {channelData}");
            Save(entry);
        }