Add serde defaults for logging
This commit is contained in:
parent
68ab173ee8
commit
7db8c0ed97
@ -8,6 +8,7 @@ pub struct CommandsConfig {
|
||||
#[serde_inline_default(true)]
|
||||
pub use_console: bool,
|
||||
/// Should be commands from players be logged in console?
|
||||
#[serde_inline_default(true)]
|
||||
pub log_console: bool, // TODO: commands...
|
||||
}
|
||||
|
||||
|
||||
@ -43,20 +43,14 @@ pub static BASIC_CONFIG: LazyLock<BasicConfiguration> = LazyLock::new(BasicConfi
|
||||
/// This also allows you get some Performance or Resource boosts.
|
||||
/// Important: The Configuration should match Vanilla by default
|
||||
#[derive(Deserialize, Serialize, Default)]
|
||||
#[serde(default)]
|
||||
pub struct AdvancedConfiguration {
|
||||
#[serde(default)]
|
||||
pub proxy: ProxyConfig,
|
||||
#[serde(default)]
|
||||
pub authentication: AuthenticationConfig,
|
||||
#[serde(default)]
|
||||
pub packet_compression: CompressionConfig,
|
||||
#[serde(default)]
|
||||
pub resource_pack: ResourcePackConfig,
|
||||
#[serde(default)]
|
||||
pub commands: CommandsConfig,
|
||||
#[serde(default)]
|
||||
pub rcon: RCONConfig,
|
||||
#[serde(default)]
|
||||
pub pvp: PVPConfig,
|
||||
pub logging: LoggingConfig,
|
||||
}
|
||||
|
||||
@ -1,12 +1,20 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_inline_default::serde_inline_default;
|
||||
|
||||
#[serde_inline_default]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct LoggingConfig {
|
||||
#[serde_inline_default(true)]
|
||||
pub enabled: bool,
|
||||
#[serde_inline_default(LevelFilter::Info)]
|
||||
pub level: LevelFilter,
|
||||
#[serde_inline_default(false)]
|
||||
pub env: bool,
|
||||
#[serde_inline_default(true)]
|
||||
pub threads: bool,
|
||||
#[serde_inline_default(true)]
|
||||
pub color: bool,
|
||||
#[serde_inline_default(true)]
|
||||
pub timestamp: bool,
|
||||
}
|
||||
|
||||
|
||||
@ -23,15 +23,20 @@ pub struct RCONConfig {
|
||||
pub logging: RCONLogging,
|
||||
}
|
||||
|
||||
#[serde_inline_default]
|
||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||
pub struct RCONLogging {
|
||||
/// Whether successful RCON logins should be logged.
|
||||
#[serde_inline_default(true)]
|
||||
pub log_logged_successfully: bool,
|
||||
/// Whether failed RCON login attempts with incorrect passwords should be logged.
|
||||
#[serde_inline_default(true)]
|
||||
pub log_wrong_password: bool,
|
||||
/// Whether all RCON commands, regardless of success or failure, should be logged.
|
||||
#[serde_inline_default(true)]
|
||||
pub log_commands: bool,
|
||||
/// Whether RCON quit commands should be logged.
|
||||
#[serde_inline_default(true)]
|
||||
pub log_quit: bool,
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user