Exemplo n.º 1
0
        public void LogPendingChannelInfo(string temporaryChannelId, LocalChannelState state, string logText = "")
        {
            var entry = new LocalChannelLogEntry
            {
                Timestamp          = DateTime.Now,
                EntryType          = LocalChannelLogEntryType.Info,
                TemporaryChannelId = temporaryChannelId,
                State     = state,
                LogText   = logText,
                DebugData = GetDebugData()
            };

            _logger.LogInformation($"{logText}. State: {state}. TemporaryChannelID: {temporaryChannelId}");
            Save(entry);
        }
Exemplo n.º 2
0
        public void LogPendingChannelError(string temporaryChannelId, LocalChannelState state, LocalChannelError error,
                                           string errorText)
        {
            var entry = new LocalChannelLogEntry
            {
                Timestamp          = DateTime.Now,
                EntryType          = LocalChannelLogEntryType.Error,
                TemporaryChannelId = temporaryChannelId,
                State     = state,
                Error     = error,
                ErrorText = errorText,
                DebugData = GetDebugData()
            };

            _logger.LogError($"{error}: {errorText}. TemporaryChannelID: {temporaryChannelId}");
            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);
        }