private void LogChannelMessage(LocalChannel channel, string temporaryChannelId, Message message,
                                       LocalChannelLogEntryType type)
        {
            var entry = new LocalChannelLogEntry
            {
                ChannelId          = channel != null && channel.Id != 0 ? channel.Id : (int?)null,
                Timestamp          = DateTime.Now,
                EntryType          = type,
                TemporaryChannelId = temporaryChannelId,
                State          = channel?.State,
                AdditionalData = message.ToString()
            };

            Save(entry);
        }
        private void LogMessageValidationException(LocalChannel channel, string temporaryChannelId, Message message,
                                                   LocalChannelLogEntryType type, string errorText)
        {
            var entry = new LocalChannelLogEntry
            {
                ChannelId          = channel != null && channel.Id != 0 ? channel.Id : (int?)null,
                Timestamp          = DateTime.Now,
                EntryType          = type,
                TemporaryChannelId = temporaryChannelId,
                State          = channel?.State,
                Error          = LocalChannelError.ValidationError,
                ErrorText      = errorText,
                AdditionalData = message.ToString()
            };

            Save(entry);
        }
Esempio n. 3
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);
        }