コード例 #1
0
ファイル: SocketServer.cs プロジェクト: abayaz61/NCache
        /// <summary>
        /// Set and apply logging status
        /// </summary>
        /// <param name="subsystem"></param>
        /// <param name="type"></param>
        /// <param name="status"></param>
        public override void SetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type, LoggingInfo.LogsStatus status)
        {
            if (subsystem == LoggingInfo.LoggingSubsystem.Client)
            {
                bool updateClient = false;
                switch (type)
                {
                case LoggingInfo.LoggingType.Error:
                case LoggingInfo.LoggingType.Detailed:
                    updateClient = ConnectionManager.SetClientLoggingInfo(type, status);
                    break;

                case (LoggingInfo.LoggingType.Error | LoggingInfo.LoggingType.Detailed):
                    bool updateErrorLogs    = ConnectionManager.SetClientLoggingInfo(LoggingInfo.LoggingType.Error, status);
                    bool updateDetailedLogs = ConnectionManager.SetClientLoggingInfo(LoggingInfo.LoggingType.Detailed, status);
                    updateClient = (updateErrorLogs || updateDetailedLogs);
                    break;
                }

                if (updateClient)
                {
                    ConnectionManager.UpdateClients();
                }
            }
            else if (subsystem == LoggingInfo.LoggingSubsystem.Server)
            {
                switch (status)
                {
                case LoggingInfo.LogsStatus.Disable:
                    // If error logs are disabled, then disable both
                    if (type == LoggingInfo.LoggingType.Error ||
                        type == (LoggingInfo.LoggingType.Error | LoggingInfo.LoggingType.Detailed))
                    {
                        this.InitializeLogging(false, false);
                    }
                    else if (type == LoggingInfo.LoggingType.Detailed)
                    {
                        this.InitializeLogging(Logger.IsErrorLogsEnabled, false);
                    }
                    break;

                case LoggingInfo.LogsStatus.Enable:

                    bool error    = Logger.IsErrorLogsEnabled;
                    bool detailed = Logger.IsDetailedLogsEnabled;

                    if (type == LoggingInfo.LoggingType.Error)
                    {
                        error    = true;
                        detailed = false;
                    }
                    else if (type == LoggingInfo.LoggingType.Detailed |
                             type == (LoggingInfo.LoggingType.Error | LoggingInfo.LoggingType.Detailed))
                    {
                        error    = true;
                        detailed = true;
                    }

                    this.InitializeLogging(error, detailed);

                    break;
                }
            }
        }
コード例 #2
0
ファイル: CacheRenderer.cs プロジェクト: usamabintariq/NCache
 /// <summary>
 /// Set and apply logging status for a logging type
 /// </summary>
 /// <param name="type">Type of logging</param>
 /// <param name="status">Logging status to set</param>
 public abstract void SetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type, LoggingInfo.LogsStatus status);