1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

Add ClientBuilder:new_without_log (#93)

* Add ClientBuilder:new_without_log

* 'log' feature

* fix warnings

---------

Co-authored-by: mat <git@matdoes.dev>
This commit is contained in:
xtex 2023-06-25 06:43:38 +08:00 committed by GitHub
parent 5e46996882
commit ea8a8fccb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 6 deletions

View file

@ -17,6 +17,7 @@ members = [
"azalea-registry",
"azalea-inventory",
]
resolver = "2"
[profile.release]
debug = true

View file

@ -38,3 +38,8 @@ regex = "1.7.0"
thiserror = "^1.0.34"
tokio = { version = "^1.24.2", features = ["sync"] }
uuid = "^1.1.2"
[features]
default = ["log"]
# enables bevy_log::LogPlugin by default
log = []

View file

@ -55,7 +55,6 @@ use bevy_ecs::{
system::{ResMut, Resource},
world::World,
};
use bevy_log::LogPlugin;
use bevy_time::{prelude::FixedTime, TimePlugin};
use derive_more::{Deref, DerefMut};
use log::{debug, error};
@ -694,10 +693,10 @@ pub struct DefaultPlugins;
impl PluginGroup for DefaultPlugins {
fn build(self) -> PluginGroupBuilder {
PluginGroupBuilder::start::<Self>()
.add(LogPlugin::default())
#[allow(unused_mut)]
let mut group = PluginGroupBuilder::start::<Self>()
.add(AmbiguityLoggerPlugin)
.add(TimePlugin::default())
.add(TimePlugin)
.add(PacketHandlerPlugin)
.add(AzaleaPlugin)
.add(EntityPlugin)
@ -710,6 +709,11 @@ impl PluginGroup for DefaultPlugins {
.add(PlayerMovePlugin)
.add(InteractPlugin)
.add(RespawnPlugin)
.add(TickBroadcastPlugin)
.add(TickBroadcastPlugin);
#[cfg(feature = "log")]
{
group = group.add(bevy_log::LogPlugin::default());
}
group
}
}

View file

@ -40,3 +40,8 @@ thiserror = "^1.0.37"
tokio = "^1.24.2"
uuid = "1.2.2"
bevy_log = "0.10.1"
[features]
default = ["log"]
# enables bevy_log::LogPlugin by default
log = ["azalea-client/log"]

View file

@ -93,7 +93,7 @@ One of the most useful tools for debugging issues is logging. The default log le
If it's a crash/panic and you believe it has to do with parsing a packet, you might want to set the level to `trace` since that'll make it show the first few hundred bytes of every packet received. This may produce a lot of logs, so pipe it into a file with `&> azalea.log` (on Linux).
Note: If you get a `SetLoggerError`, it's because you have multiple loggers. Azalea comes with a logger by default, see [`bevy_log`] for more information.
Note: If you get a `SetLoggerError`, it's because you have multiple loggers. Azalea comes with a logger by default, see [`bevy_log`] for more information. You can disable the default logging plugin by disabling the `log` feature.
## Deadlocks

View file

@ -89,6 +89,9 @@ where
/// [`Self::new`] but without adding the plugins by default. This is useful
/// if you want to disable a default plugin.
///
/// Note that you can also disable `LogPlugin` by disabling the `log`
/// feature.
///
/// You **must** add [`DefaultPlugins`] and [`DefaultBotPlugins`] to this.
///
/// ```