コード例 #1
0
        /// <summary>
        /// Logs the debug message
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="session">The session.</param>
        /// <param name="message">The message.</param>
        public static void Debug(this ILog logger, ISessionBase session, string message)
        {
            if (!logger.IsDebugEnabled)
                return;

            logger.Debug(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + message);
        }
コード例 #2
0
        /// <summary>
        /// Logs the debug message
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="session">The session.</param>
        /// <param name="message">The message.</param>
        public static void Debug(this ILog logger, ISessionBase session, string message)
        {
            if (!logger.IsDebugEnabled)
            {
                return;
            }

            logger.Debug(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + message);
        }
コード例 #3
0
ファイル: Transaction.cs プロジェクト: Klegy/MicroLite
        /// <summary>
        /// Initialises a new instance of the <see cref="Transaction" /> class.
        /// </summary>
        /// <param name="sessionBase">The session that the transaction is being created for.</param>
        /// <param name="isolationLevel">The isolation level.</param>
        internal Transaction(ISessionBase sessionBase, IsolationLevel isolationLevel)
        {
            _sessionBase = sessionBase;

            if (s_log.IsDebug)
            {
                s_log.Debug(LogMessages.Transaction_BeginTransactionWithIsolationLevel, isolationLevel.ToString());
            }

            _transaction = _sessionBase.Connection.BeginTransaction(isolationLevel);
        }
コード例 #4
0
        /// <summary>
        /// Initialises a new instance of the <see cref="Transaction" /> class.
        /// </summary>
        /// <param name="sessionBase">The session that the transaction is being created for.</param>
        /// <param name="isolationLevel">The isolation level.</param>
        internal Transaction(ISessionBase sessionBase, IsolationLevel isolationLevel)
        {
            this.sessionBase = sessionBase;

            if (log.IsDebug)
            {
                log.Debug(LogMessages.Transaction_BeginTransactionWithIsolationLevel, isolationLevel.ToString());
            }

            this.transaction = this.sessionBase.Connection.BeginTransaction(isolationLevel);
        }
コード例 #5
0
 private bool CheckSessionId(string sessionId)
 {
     using (var scope = LocContainer.Main.BeginLifetimeScope())
     {
         if (_session == null)
         {
             _session = scope.Resolve <ISessionBase>();
         }
         return(_session.CheckSession(sessionId));
     }
 }
コード例 #6
0
ファイル: Transaction.cs プロジェクト: Klegy/MicroLite
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                try
                {
                    if (IsActive)
                    {
                        s_log.Warn(LogMessages.Transaction_DisposedUncommitted);
                        RollbackTransaction();
                    }
                    else if (_failed && !_rolledBack)
                    {
                        s_log.Warn(LogMessages.Transaction_RollingBackFailedCommit);
                        RollbackTransaction();
                    }
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch
#pragma warning restore CA1031 // Do not catch general exception types
                {
                }
                finally
                {
                    _transaction.Dispose();
                    _transaction = null;
                    _sessionBase = null;
                    _disposed    = true;

                    if (s_log.IsDebug)
                    {
                        s_log.Debug(LogMessages.Transaction_Disposed);
                    }
                }
            }
        }
コード例 #7
0
        private void Dispose(bool disposing)
        {
            if (this.disposed)
            {
                return;
            }

            if (disposing)
            {
                try
                {
                    if (this.IsActive)
                    {
                        log.Warn(LogMessages.Transaction_DisposedUncommitted);
                        this.RollbackTransaction();
                    }
                    else if (this.failed && !this.rolledBack)
                    {
                        log.Warn(LogMessages.Transaction_RollingBackFailedCommit);
                        this.RollbackTransaction();
                    }
                }
                catch
                {
                }
                finally
                {
                    this.transaction.Dispose();
                    this.transaction = null;
                    this.sessionBase = null;
                    this.disposed    = true;

                    if (log.IsDebug)
                    {
                        log.Debug(LogMessages.Transaction_Disposed);
                    }
                }
            }
        }
コード例 #8
0
        private void Dispose(bool disposing)
        {
            if (this.disposed)
            {
                return;
            }

            if (disposing)
            {
                try
                {
                    if (this.IsActive)
                    {
                        log.Warn(LogMessages.Transaction_DisposedUncommitted);
                        this.RollbackTransaction();
                    }
                    else if (this.failed && !this.rolledBack)
                    {
                        log.Warn(LogMessages.Transaction_RollingBackFailedCommit);
                        this.RollbackTransaction();
                    }
                }
                catch
                {
                }
                finally
                {
                    this.transaction.Dispose();
                    this.transaction = null;
                    this.sessionBase = null;
                    this.disposed = true;

                    if (log.IsDebug)
                    {
                        log.Debug(LogMessages.Transaction_Disposed);
                    }
                }
            }
        }
コード例 #9
0
 /// <summary>
 /// Logs the information
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="session">The session.</param>
 /// <param name="message">The message.</param>
 public static void Info(this ILog logger, ISessionBase session, string message)
 {
     string info = string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + message;
     logger.Info(info);
 }
コード例 #10
0
 /// <summary>
 /// Logs the error
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="session">The session.</param>
 /// <param name="message">The message.</param>
 public static void Error(this ILog logger, ISessionBase session, string message)
 {
     logger.Error(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + message);
 }
コード例 #11
0
ファイル: LoggerExtension.cs プロジェクト: sandeep526/NewUG12
 public static void LogDebug(this ILogger logger, ISessionBase session, string message)
 {
     logger.LogDebug(string.Format(m_SessionInfoTemplate, session.IdentityKey, session.RemoteEndPoint) + Environment.NewLine + message);
 }
コード例 #12
0
        /// <summary>
        /// Logs the information
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="session">The session.</param>
        /// <param name="message">The message.</param>
        public static void Info(this ILog logger, ISessionBase session, string message)
        {
            string info = string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + message;

            logger.Info(info);
        }
コード例 #13
0
ファイル: AzureService.cs プロジェクト: riksking/SurveySystem
        public AzureService(ILoggerFactory loggerFactory, IOptions <AzureServiceOptions> azureServiceOptions, ISessionBase sessionBase)
        {
            _cloudStorageAccount = string.IsNullOrWhiteSpace(azureServiceOptions?.Value?.ConnectionString) ? throw new ArgumentNullException(nameof(azureServiceOptions)) : CloudStorageAccount.Parse(azureServiceOptions.Value.ConnectionString);


            _logger    = loggerFactory.CreateLogger <AnswerService>();
            _sessionId = sessionBase.SessionId;
        }
コード例 #14
0
 /// <summary>
 /// Logs the error with the session's information
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="title">The title.</param>
 /// <param name="e">The e.</param>
 /// <param name="session">The session.</param>
 public static void Error(this ILog logger, string title, Exception e, ISessionBase session)
 {
     logger.Error(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + title, e);
 }
コード例 #15
0
        public AnswerService(ILoggerFactory loggerFactory, ISurveySystemDbContext dbContext, ISessionBase sessionBase)
        {
            _dbContext = (SurveySystemDbContext)dbContext ?? throw new ArgumentNullException(nameof(dbContext));

            _dbContext.Database.EnsureCreated();

            _logger    = loggerFactory.CreateLogger <AnswerService>();
            _sessionId = sessionBase.SessionId;
        }
コード例 #16
0
 /// <summary>
 /// Logs the error
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="session">The session.</param>
 /// <param name="e">The e.</param>
 public static void Error(this ILog logger, ISessionBase session, Exception e)
 {
     logger.Error(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint), e);
 }
コード例 #17
0
 /// <summary>
 /// Logs the error with the session's information
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="title">The title.</param>
 /// <param name="e">The e.</param>
 /// <param name="session">The session.</param>
 public static void Error(this ILog logger, string title, Exception e, ISessionBase session)
 {
     logger.Error(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + title, e);
 }
コード例 #18
0
ファイル: LoggerExtension.cs プロジェクト: xxjeng/nuxleus
 /// <summary>
 /// Logs the error
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="session">The session.</param>
 /// <param name="e">The e.</param>
 public static void Error(this ILog logger, ISessionBase session, Exception e)
 {
     logger.Error(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint), e);
 }
コード例 #19
0
ファイル: LoggerExtension.cs プロジェクト: sandeep526/NewUG12
 public static void LogError(this ILogger logger, ISessionBase session, string title, Exception e)
 {
     logger.LogError(string.Format(m_SessionInfoTemplate, session.IdentityKey, session.RemoteEndPoint) + Environment.NewLine + title, e);
 }
コード例 #20
0
 /// <summary>
 /// Logs the error
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="session">The session.</param>
 /// <param name="message">The message.</param>
 public static void Error(this ILog logger, ISessionBase session, string message)
 {
     logger.Error(string.Format(m_SessionInfoTemplate, session.SessionID, session.RemoteEndPoint) + Environment.NewLine + message);
 }
コード例 #21
0
 public static void LogError(this ILogger logger, ISessionBase session, string title, Exception e)
 {
     logger.LogError(string.Format(m_SessionInfoTemplate, session.IdentityKey, session.RemoteEndPoint) + Environment.NewLine + title, e);
 }
コード例 #22
0
 public static void LogDebug(this ILogger logger, ISessionBase session, string message)
 {
     logger.LogDebug(string.Format(m_SessionInfoTemplate, session.IdentityKey, session.RemoteEndPoint) + Environment.NewLine + message);
 }
コード例 #23
0
 public AnswerController(ILoggerFactory logger, IAnswerService answerService, IAzureService azureService, ISessionBase sessionBase)
 {
     _logger        = logger.CreateLogger <AnswerController>();
     _answerService = answerService;
     _azureService  = azureService;
     _sessionId     = sessionBase.SessionId;
 }
コード例 #24
0
 public static void LogError(this ILogger logger, ISessionBase session, Exception e)
 {
     logger.LogError(string.Format(m_SessionInfoTemplate, session.IdentityKey, session.RemoteEndPoint), e);
 }
コード例 #25
0
ファイル: LoggerExtension.cs プロジェクト: sandeep526/NewUG12
 public static void LogError(this ILogger logger, ISessionBase session, Exception e)
 {
     logger.LogError(string.Format(m_SessionInfoTemplate, session.IdentityKey, session.RemoteEndPoint), e);
 }