Exemplo n.º 1
0
        /// <summary>
        /// Application Error logging
        /// </summary>
        /// <param name="logLevel"></param>
        /// <param name="exception"></param>
        /// <param name="innerExceptionOnly"></param>
        /// <param name="writeToPlatform"></param>
        public async void Error(LogLevel logLevel, Exception exception, bool innerExceptionOnly, bool writeToPlatform)
        {
            try
            {
                _logicHelper.LogToPlatform(APPLICATION_ERROR, exception, innerExceptionOnly, null, writeToPlatform);

                if (_logicHelper.ShouldSendToQueue(logLevel))
                {
                    var application = PopulateApplicationEntity(exception, innerExceptionOnly, writeToPlatform, logLevel, null);

                    var queueMessage = _logicHelper.MessageConversion(application);
                    await _queueMessenger.SendMessage(queueMessage);
                }
            }
            catch (Exception ex)
            {
                _logicHelper.LogToPlatform(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, ex, false, null, true);
            }
        }
        /// <summary>
        /// Relation Database Error logging
        /// </summary>
        /// <param name="logLevel"></param>
        /// <param name="exception"></param>
        /// <param name="innerExceptionOnly"></param>
        /// <param name="writeToPlatform"></param>
        public async void Error(EnumCollection.LogLevel logLevel, Exception exception, bool innerExceptionOnly, bool writeToPlatform)
        {
            try
            {
                _logicHelper.LogToPlatform(DATABASE_ERROR, exception, innerExceptionOnly, null, writeToPlatform);

                if (_logicHelper.ShouldSendToQueue(logLevel))
                {
                    var relationalDatabase = PopulateRelationalDatabaseEntity(logLevel, exception, null, innerExceptionOnly, writeToPlatform);

                    var queueMessage = _logicHelper.MessageConversion(relationalDatabase);
                    await _queueMessenger.SendMessage(queueMessage);
                }
            }
            catch (Exception ex)
            {
                _logicHelper.LogToPlatform(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, ex, false, null, true);
            }
        }
Exemplo n.º 3
0
    /// <summary>
    /// Log Message popped from message queue
    /// </summary>
    /// <param name="logLevel"></param>
    /// <param name="message"></param>
    /// <param name="writeToPlatform"></param>
    public async void PopMessage(LogLevel logLevel, string message, bool writeToPlatform)
    {
        _logicHelper.LogToPlatform(POP_MESSAGE_TYPE, message, null, writeToPlatform);

        try
        {
            if (_logicHelper.ShouldSendToQueue(logLevel))
            {
                var messageQueue = PopulateMessageQueueEntity(logLevel, message, null, null, writeToPlatform);

                var queueMessage = _logicHelper.MessageConversion(messageQueue);
                await _queueMessenger.SendMessage(queueMessage);
            }
        }
        catch (Exception ex)
        {
            _logicHelper.LogToPlatform(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, ex, false, null, true);
        }
    }