public void EnableLogging(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type) { ManagementCommand command = GetManagementCommand(ManagementUtil.MethodName.EnableLogging); command.Parameters.AddParameter(subsystem); command.Parameters.AddParameter(type); ExecuteCommandOnCacehServer(command); }
/// <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; } } }
/// <summary> /// Get current logging status for specified type /// </summary> /// <param name="subsystem"></param> /// <param name="type"></param> /// <returns></returns> public override LoggingInfo.LogsStatus GetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type) { switch (subsystem) { case LoggingInfo.LoggingSubsystem.Server: lock (_serverLoggingInfo) { return(_serverLoggingInfo.GetStatus(type)); } case LoggingInfo.LoggingSubsystem.Client: return(ConnectionManager.GetClientLoggingInfo(type)); default: return(LoggingInfo.LogsStatus.Disable); } }
/// <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);
/// <summary> /// Get logging status for logging type /// </summary> /// <param name="type">Type of logging</param> /// <returns>Current status of logging</returns> public abstract LoggingInfo.LogsStatus GetLoggingStatus(LoggingInfo.LoggingSubsystem subsystem, LoggingInfo.LoggingType type);