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

replace log with tracing

This commit is contained in:
mat 2023-11-18 00:58:47 -06:00
parent b79ae025f0
commit 9633508a3a
40 changed files with 63 additions and 64 deletions

19
Cargo.lock generated
View file

@ -188,7 +188,6 @@ dependencies = [
"derive_more", "derive_more",
"futures", "futures",
"futures-lite 2.0.1", "futures-lite 2.0.1",
"log",
"nohash-hasher", "nohash-hasher",
"num-traits", "num-traits",
"parking_lot", "parking_lot",
@ -197,6 +196,7 @@ dependencies = [
"rustc-hash", "rustc-hash",
"thiserror", "thiserror",
"tokio", "tokio",
"tracing",
"uuid", "uuid",
] ]
@ -209,7 +209,6 @@ dependencies = [
"base64", "base64",
"chrono", "chrono",
"env_logger", "env_logger",
"log",
"num-bigint", "num-bigint",
"once_cell", "once_cell",
"reqwest", "reqwest",
@ -218,6 +217,7 @@ dependencies = [
"serde_json", "serde_json",
"thiserror", "thiserror",
"tokio", "tokio",
"tracing",
"uuid", "uuid",
] ]
@ -254,9 +254,9 @@ version = "0.8.0"
dependencies = [ dependencies = [
"azalea-buf-macros", "azalea-buf-macros",
"byteorder", "byteorder",
"log",
"serde_json", "serde_json",
"thiserror", "thiserror",
"tracing",
"uuid", "uuid",
] ]
@ -275,10 +275,10 @@ version = "0.8.0"
dependencies = [ dependencies = [
"azalea-buf", "azalea-buf",
"azalea-language", "azalea-language",
"log",
"once_cell", "once_cell",
"serde", "serde",
"serde_json", "serde_json",
"tracing",
] ]
[[package]] [[package]]
@ -307,7 +307,6 @@ dependencies = [
"bevy_time", "bevy_time",
"derive_more", "derive_more",
"futures", "futures",
"log",
"nohash-hasher", "nohash-hasher",
"once_cell", "once_cell",
"parking_lot", "parking_lot",
@ -317,6 +316,7 @@ dependencies = [
"serde_json", "serde_json",
"thiserror", "thiserror",
"tokio", "tokio",
"tracing",
"uuid", "uuid",
] ]
@ -368,10 +368,10 @@ dependencies = [
"bevy_ecs", "bevy_ecs",
"derive_more", "derive_more",
"enum-as-inner", "enum-as-inner",
"log",
"nohash-hasher", "nohash-hasher",
"parking_lot", "parking_lot",
"thiserror", "thiserror",
"tracing",
"uuid", "uuid",
] ]
@ -415,9 +415,9 @@ dependencies = [
"fastnbt", "fastnbt",
"flate2", "flate2",
"graphite_binary", "graphite_binary",
"log",
"serde", "serde",
"thiserror", "thiserror",
"tracing",
"valence_nbt", "valence_nbt",
] ]
@ -434,9 +434,9 @@ dependencies = [
"bevy_app", "bevy_app",
"bevy_ecs", "bevy_ecs",
"bevy_time", "bevy_time",
"log",
"once_cell", "once_cell",
"parking_lot", "parking_lot",
"tracing",
"uuid", "uuid",
] ]
@ -467,7 +467,6 @@ dependencies = [
"futures", "futures",
"futures-lite 2.0.1", "futures-lite 2.0.1",
"futures-util", "futures-util",
"log",
"once_cell", "once_cell",
"serde", "serde",
"serde_json", "serde_json",
@ -523,11 +522,11 @@ dependencies = [
"criterion", "criterion",
"derive_more", "derive_more",
"enum-as-inner", "enum-as-inner",
"log",
"nohash-hasher", "nohash-hasher",
"once_cell", "once_cell",
"parking_lot", "parking_lot",
"thiserror", "thiserror",
"tracing",
"uuid", "uuid",
] ]

View file

@ -13,7 +13,7 @@ azalea-buf = { path = "../azalea-buf", version = "0.8.0" }
azalea-crypto = { path = "../azalea-crypto", version = "0.8.0" } azalea-crypto = { path = "../azalea-crypto", version = "0.8.0" }
base64 = "0.21.5" base64 = "0.21.5"
chrono = { version = "0.4.31", default-features = false, features = ["serde"] } chrono = { version = "0.4.31", default-features = false, features = ["serde"] }
log = "0.4.20" tracing = "0.1.40"
num-bigint = "0.4.4" num-bigint = "0.4.4"
once_cell = "1.18.0" once_cell = "1.18.0"
reqwest = { version = "0.11.22", default-features = false, features = [ reqwest = { version = "0.11.22", default-features = false, features = [

View file

@ -83,12 +83,12 @@ pub async fn auth(email: &str, opts: AuthOpts) -> Result<AuthResult, AuthError>
interactive_get_ms_auth_token(&client, email).await? interactive_get_ms_auth_token(&client, email).await?
}; };
if msa.is_expired() { if msa.is_expired() {
log::trace!("refreshing Microsoft auth token"); tracing::trace!("refreshing Microsoft auth token");
msa = refresh_ms_auth_token(&client, &msa.data.refresh_token).await?; msa = refresh_ms_auth_token(&client, &msa.data.refresh_token).await?;
} }
let msa_token = &msa.data.access_token; let msa_token = &msa.data.access_token;
log::trace!("Got access token: {msa_token}"); tracing::trace!("Got access token: {msa_token}");
let res = get_minecraft_token(&client, msa_token).await?; let res = get_minecraft_token(&client, msa_token).await?;
@ -115,7 +115,7 @@ pub async fn auth(email: &str, opts: AuthOpts) -> Result<AuthResult, AuthError>
) )
.await .await
{ {
log::error!("{}", e); tracing::error!("{}", e);
} }
} }
@ -309,7 +309,7 @@ pub async fn get_ms_auth_token(
while Instant::now() < login_expires_at { while Instant::now() < login_expires_at {
tokio::time::sleep(std::time::Duration::from_secs(res.interval)).await; tokio::time::sleep(std::time::Duration::from_secs(res.interval)).await;
log::trace!("Polling to check if user has logged in..."); tracing::trace!("Polling to check if user has logged in...");
if let Ok(access_token_response) = client if let Ok(access_token_response) = client
.post(format!( .post(format!(
"https://login.live.com/oauth20_token.srf?client_id={CLIENT_ID}" "https://login.live.com/oauth20_token.srf?client_id={CLIENT_ID}"
@ -324,7 +324,7 @@ pub async fn get_ms_auth_token(
.json::<AccessTokenResponse>() .json::<AccessTokenResponse>()
.await .await
{ {
log::trace!("access_token_response: {:?}", access_token_response); tracing::trace!("access_token_response: {:?}", access_token_response);
let expires_at = SystemTime::now() let expires_at = SystemTime::now()
+ std::time::Duration::from_secs(access_token_response.expires_in); + std::time::Duration::from_secs(access_token_response.expires_in);
return Ok(ExpiringValue { return Ok(ExpiringValue {
@ -348,7 +348,7 @@ pub async fn interactive_get_ms_auth_token(
email: &str, email: &str,
) -> Result<ExpiringValue<AccessTokenResponse>, GetMicrosoftAuthTokenError> { ) -> Result<ExpiringValue<AccessTokenResponse>, GetMicrosoftAuthTokenError> {
let res = get_ms_link_code(client).await?; let res = get_ms_link_code(client).await?;
log::trace!("Device code response: {:?}", res); tracing::trace!("Device code response: {:?}", res);
println!( println!(
"Go to \x1b[1m{}\x1b[m and enter the code \x1b[1m{}\x1b[m for \x1b[1m{}\x1b[m", "Go to \x1b[1m{}\x1b[m and enter the code \x1b[1m{}\x1b[m for \x1b[1m{}\x1b[m",
res.verification_uri, res.user_code, email res.verification_uri, res.user_code, email
@ -415,7 +415,7 @@ async fn auth_with_xbox_live(
"TokenType": "JWT" "TokenType": "JWT"
}); });
let payload = auth_json.to_string(); let payload = auth_json.to_string();
log::trace!("auth_json: {:#?}", auth_json); tracing::trace!("auth_json: {:#?}", auth_json);
let res = client let res = client
.post("https://user.auth.xboxlive.com/user/authenticate") .post("https://user.auth.xboxlive.com/user/authenticate")
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
@ -428,7 +428,7 @@ async fn auth_with_xbox_live(
.await? .await?
.json::<XboxLiveAuthResponse>() .json::<XboxLiveAuthResponse>()
.await?; .await?;
log::trace!("Xbox Live auth response: {:?}", res); tracing::trace!("Xbox Live auth response: {:?}", res);
// not_after looks like 2020-12-21T19:52:08.4463796Z // not_after looks like 2020-12-21T19:52:08.4463796Z
let expires_at = DateTime::parse_from_rfc3339(&res.not_after) let expires_at = DateTime::parse_from_rfc3339(&res.not_after)
@ -469,7 +469,7 @@ async fn obtain_xsts_for_minecraft(
.await? .await?
.json::<XboxLiveAuthResponse>() .json::<XboxLiveAuthResponse>()
.await?; .await?;
log::trace!("Xbox Live auth response (for XSTS): {:?}", res); tracing::trace!("Xbox Live auth response (for XSTS): {:?}", res);
Ok(res.token) Ok(res.token)
} }
@ -495,7 +495,7 @@ async fn auth_with_minecraft(
.await? .await?
.json::<MinecraftAuthResponse>() .json::<MinecraftAuthResponse>()
.await?; .await?;
log::trace!("{:?}", res); tracing::trace!("{:?}", res);
let expires_at = SystemTime::now() + std::time::Duration::from_secs(res.expires_in); let expires_at = SystemTime::now() + std::time::Duration::from_secs(res.expires_in);
Ok(ExpiringValue { Ok(ExpiringValue {
@ -522,7 +522,7 @@ async fn check_ownership(
.await? .await?
.json::<GameOwnershipResponse>() .json::<GameOwnershipResponse>()
.await?; .await?;
log::trace!("{:?}", res); tracing::trace!("{:?}", res);
// vanilla checks here to make sure the signatures are right, but it's not // vanilla checks here to make sure the signatures are right, but it's not
// actually required so we just don't // actually required so we just don't
@ -547,7 +547,7 @@ pub async fn get_profile(
.await? .await?
.json::<ProfileResponse>() .json::<ProfileResponse>()
.await?; .await?;
log::trace!("{:?}", res); tracing::trace!("{:?}", res);
Ok(res) Ok(res)
} }

View file

@ -82,13 +82,13 @@ async fn get_entire_cache(cache_file: &Path) -> Result<Vec<CachedAccount>, Cache
Ok(cache) Ok(cache)
} }
async fn set_entire_cache(cache_file: &Path, cache: Vec<CachedAccount>) -> Result<(), CacheError> { async fn set_entire_cache(cache_file: &Path, cache: Vec<CachedAccount>) -> Result<(), CacheError> {
log::trace!("saving cache: {:?}", cache); tracing::trace!("saving cache: {:?}", cache);
if !cache_file.exists() { if !cache_file.exists() {
let cache_file_parent = cache_file let cache_file_parent = cache_file
.parent() .parent()
.expect("Cache file is root directory and also doesn't exist."); .expect("Cache file is root directory and also doesn't exist.");
log::debug!( tracing::debug!(
"Making cache file parent directory at {}", "Making cache file parent directory at {}",
cache_file_parent.to_string_lossy() cache_file_parent.to_string_lossy()
); );

View file

@ -26,7 +26,7 @@ pub async fn fetch_certificates(
.await? .await?
.json::<CertificatesResponse>() .json::<CertificatesResponse>()
.await?; .await?;
log::trace!("{:?}", res); tracing::trace!("{:?}", res);
// using RsaPrivateKey::from_pkcs8_pem gives an error with decoding base64 so we // using RsaPrivateKey::from_pkcs8_pem gives an error with decoding base64 so we
// just decode it ourselves // just decode it ourselves

View file

@ -1,10 +1,10 @@
//! Tell Mojang you're joining a multiplayer server. //! Tell Mojang you're joining a multiplayer server.
use log::debug;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use reqwest::StatusCode; use reqwest::StatusCode;
use serde::Deserialize; use serde::Deserialize;
use serde_json::json; use serde_json::json;
use thiserror::Error; use thiserror::Error;
use tracing::debug;
use uuid::Uuid; use uuid::Uuid;
use crate::game_profile::{GameProfile, SerializableGameProfile}; use crate::game_profile::{GameProfile, SerializableGameProfile};

View file

@ -11,7 +11,7 @@ version = "0.8.0"
[dependencies] [dependencies]
azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.8.0" } azalea-buf-macros = { path = "./azalea-buf-macros", version = "0.8.0" }
byteorder = "^1.5.0" byteorder = "^1.5.0"
log = "0.4.20" tracing = "0.1.40"
serde_json = { version = "^1.0", optional = true } serde_json = { version = "^1.0", optional = true }
thiserror = "1.0.50" thiserror = "1.0.50"
uuid = "^1.5.0" uuid = "^1.5.0"

View file

@ -1,6 +1,5 @@
use super::{UnsizedByteArray, MAX_STRING_LENGTH}; use super::{UnsizedByteArray, MAX_STRING_LENGTH};
use byteorder::{ReadBytesExt, BE}; use byteorder::{ReadBytesExt, BE};
use log::warn;
use std::{ use std::{
backtrace::Backtrace, backtrace::Backtrace,
collections::HashMap, collections::HashMap,
@ -8,6 +7,7 @@ use std::{
io::{Cursor, Read}, io::{Cursor, Read},
}; };
use thiserror::Error; use thiserror::Error;
use tracing::warn;
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum BufReadError { pub enum BufReadError {

View file

@ -16,7 +16,7 @@ azalea-buf = { path = "../azalea-buf", features = [
"serde_json", "serde_json",
], version = "^0.8.0", optional = true } ], version = "^0.8.0", optional = true }
azalea-language = { path = "../azalea-language", version = "0.8.0" } azalea-language = { path = "../azalea-language", version = "0.8.0" }
log = "0.4.20" tracing = "0.1.40"
once_cell = "1.18.0" once_cell = "1.18.0"
serde = { version = "^1.0", features = ["derive"] } serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0.108" serde_json = "^1.0.108"

View file

@ -6,13 +6,13 @@ use crate::{
}; };
#[cfg(feature = "azalea-buf")] #[cfg(feature = "azalea-buf")]
use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
use log::debug;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde::{de, Deserialize, Deserializer, Serialize}; use serde::{de, Deserialize, Deserializer, Serialize};
use std::{ use std::{
fmt::Display, fmt::Display,
io::{Cursor, Write}, io::{Cursor, Write},
}; };
use tracing::debug;
/// A chat component, basically anything you can see in chat. /// A chat component, basically anything you can see in chat.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Hash)]

View file

@ -31,7 +31,7 @@ bevy_time = "0.12.0"
azalea-inventory = { path = "../azalea-inventory", version = "0.8.0" } azalea-inventory = { path = "../azalea-inventory", version = "0.8.0" }
derive_more = { version = "0.99.17", features = ["deref", "deref_mut"] } derive_more = { version = "0.99.17", features = ["deref", "deref_mut"] }
futures = "0.3.29" futures = "0.3.29"
log = "0.4.20" tracing = "0.1.40"
nohash-hasher = "0.2.0" nohash-hasher = "0.2.0"
once_cell = "1.18.0" once_cell = "1.18.0"
parking_lot = { version = "^0.12.1", features = ["deadlock_detection"] } parking_lot = { version = "^0.12.1", features = ["deadlock_detection"] }

View file

@ -145,7 +145,7 @@ impl Account {
let client = reqwest::Client::new(); let client = reqwest::Client::new();
if msa.is_expired() { if msa.is_expired() {
log::trace!("refreshing Microsoft auth token"); tracing::trace!("refreshing Microsoft auth token");
msa = azalea_auth::refresh_ms_auth_token(&client, &msa.data.refresh_token).await?; msa = azalea_auth::refresh_ms_auth_token(&client, &msa.data.refresh_token).await?;
} }

View file

@ -65,7 +65,6 @@ use bevy_ecs::{
}; };
use bevy_time::{Fixed, Time, TimePlugin}; use bevy_time::{Fixed, Time, TimePlugin};
use derive_more::Deref; use derive_more::Deref;
use log::{debug, error};
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use std::{ use std::{
collections::HashMap, fmt::Debug, io, net::SocketAddr, ops::Deref, sync::Arc, time::Duration, collections::HashMap, fmt::Debug, io, net::SocketAddr, ops::Deref, sync::Arc, time::Duration,
@ -75,6 +74,7 @@ use tokio::{
sync::{broadcast, mpsc}, sync::{broadcast, mpsc},
time, time,
}; };
use tracing::{debug, error};
use uuid::Uuid; use uuid::Uuid;
/// `Client` has the things that a user interacting with the library will want. /// `Client` has the things that a user interacting with the library will want.
@ -518,7 +518,7 @@ impl Client {
} }
if self.logged_in() { if self.logged_in() {
log::debug!( tracing::debug!(
"Sending client information (already logged in): {:?}", "Sending client information (already logged in): {:?}",
client_information client_information
); );

View file

@ -29,7 +29,7 @@ use bevy_ecs::{
system::{Commands, Query, Res}, system::{Commands, Query, Res},
}; };
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
use log::warn; use tracing::warn;
use crate::{ use crate::{
attack::handle_attack_event, attack::handle_attack_event,

View file

@ -23,7 +23,7 @@ use bevy_ecs::{
schedule::{IntoSystemConfigs, SystemSet}, schedule::{IntoSystemConfigs, SystemSet},
system::Query, system::Query,
}; };
use log::warn; use tracing::warn;
use crate::{ use crate::{
local_player::{handle_send_packet_event, PlayerAbilities, SendPacketEvent}, local_player::{handle_send_packet_event, PlayerAbilities, SendPacketEvent},

View file

@ -12,10 +12,10 @@ use bevy_ecs::{
system::Query, system::Query,
}; };
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
use log::error;
use parking_lot::RwLock; use parking_lot::RwLock;
use thiserror::Error; use thiserror::Error;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tracing::error;
use uuid::Uuid; use uuid::Uuid;
use crate::{ use crate::{

View file

@ -12,8 +12,8 @@ use azalea_protocol::read::deserialize_packet;
use azalea_world::Instance; use azalea_world::Instance;
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use bevy_ecs::system::SystemState; use bevy_ecs::system::SystemState;
use log::{debug, error, warn};
use parking_lot::RwLock; use parking_lot::RwLock;
use tracing::{debug, error, warn};
use crate::client::InConfigurationState; use crate::client::InConfigurationState;
use crate::disconnect::DisconnectEvent; use crate::disconnect::DisconnectEvent;

View file

@ -29,8 +29,8 @@ use azalea_protocol::{
}; };
use azalea_world::{Instance, InstanceContainer, InstanceName, MinecraftEntityId, PartialInstance}; use azalea_world::{Instance, InstanceContainer, InstanceName, MinecraftEntityId, PartialInstance};
use bevy_ecs::{prelude::*, system::SystemState}; use bevy_ecs::{prelude::*, system::SystemState};
use log::{debug, error, trace, warn};
use parking_lot::RwLock; use parking_lot::RwLock;
use tracing::{debug, error, trace, warn};
use crate::{ use crate::{
chat::{ChatPacket, ChatReceivedEvent}, chat::{ChatPacket, ChatReceivedEvent},

View file

@ -8,10 +8,10 @@ use azalea_protocol::{
write::serialize_packet, write::serialize_packet,
}; };
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use log::error;
use parking_lot::Mutex; use parking_lot::Mutex;
use thiserror::Error; use thiserror::Error;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tracing::error;
/// A component for clients that can read and write packets to the server. This /// A component for clients that can read and write packets to the server. This
/// works with raw bytes, so you'll have to serialize/deserialize packets /// works with raw bytes, so you'll have to serialize/deserialize packets

View file

@ -21,7 +21,7 @@ bevy_app = "0.12.0"
bevy_ecs = "0.12.0" bevy_ecs = "0.12.0"
derive_more = "0.99.17" derive_more = "0.99.17"
enum-as-inner = "0.6.0" enum-as-inner = "0.6.0"
log = "0.4.20" tracing = "0.1.40"
nohash-hasher = "0.2.0" nohash-hasher = "0.2.0"
parking_lot = "0.12.1" parking_lot = "0.12.1"
thiserror = "1.0.50" thiserror = "1.0.50"

View file

@ -8,9 +8,9 @@ use bevy_ecs::{
query::Changed, query::Changed,
system::{Commands, Query, Res, ResMut, Resource}, system::{Commands, Query, Res, ResMut, Resource},
}; };
use log::{debug, warn};
use nohash_hasher::IntMap; use nohash_hasher::IntMap;
use std::{collections::HashMap, fmt::Debug}; use std::{collections::HashMap, fmt::Debug};
use tracing::{debug, warn};
use uuid::Uuid; use uuid::Uuid;
use crate::{EntityUuid, LastSentPosition, Position}; use crate::{EntityUuid, LastSentPosition, Position};

View file

@ -8,7 +8,7 @@ use azalea_world::{InstanceContainer, InstanceName, MinecraftEntityId};
use bevy_app::{App, Plugin, PreUpdate, Update}; use bevy_app::{App, Plugin, PreUpdate, Update};
use bevy_ecs::prelude::*; use bevy_ecs::prelude::*;
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
use log::debug; use tracing::debug;
use crate::{ use crate::{
metadata::Health, Dead, EyeHeight, FluidOnEyes, LocalEntity, LookDirection, Physics, Position, metadata::Health, Dead, EyeHeight, FluidOnEyes, LocalEntity, LookDirection, Physics, Position,

View file

@ -25,8 +25,8 @@ use bevy_ecs::{
world::{EntityWorldMut, World}, world::{EntityWorldMut, World},
}; };
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
use log::warn;
use parking_lot::RwLock; use parking_lot::RwLock;
use tracing::warn;
use crate::LocalEntity; use crate::LocalEntity;

View file

@ -14,7 +14,7 @@ byteorder = "^1.5.0"
compact_str = { version = "0.7.1", features = ["serde"] } compact_str = { version = "0.7.1", features = ["serde"] }
enum-as-inner = "0.6.0" enum-as-inner = "0.6.0"
flate2 = "^1.0.28" flate2 = "^1.0.28"
log = "0.4.20" tracing = "0.1.40"
serde = { version = "^1.0", features = ["derive"], optional = true } serde = { version = "^1.0", features = ["derive"], optional = true }
thiserror = "1.0.50" thiserror = "1.0.50"

View file

@ -3,8 +3,8 @@ use crate::Error;
use azalea_buf::{BufReadError, McBufReadable}; use azalea_buf::{BufReadError, McBufReadable};
use byteorder::{ReadBytesExt, BE}; use byteorder::{ReadBytesExt, BE};
use flate2::read::{GzDecoder, ZlibDecoder}; use flate2::read::{GzDecoder, ZlibDecoder};
use log::warn;
use std::io::{BufRead, Cursor, Read}; use std::io::{BufRead, Cursor, Read};
use tracing::warn;
#[inline] #[inline]
fn read_bytes<'a>(buf: &'a mut Cursor<&[u8]>, length: usize) -> Result<&'a [u8], Error> { fn read_bytes<'a>(buf: &'a mut Cursor<&[u8]>, length: usize) -> Result<&'a [u8], Error> {

View file

@ -17,7 +17,7 @@ azalea-registry = { path = "../azalea-registry", version = "0.8.0" }
azalea-world = { path = "../azalea-world", version = "0.8.0" } azalea-world = { path = "../azalea-world", version = "0.8.0" }
bevy_app = "0.12.0" bevy_app = "0.12.0"
bevy_ecs = "0.12.0" bevy_ecs = "0.12.0"
log = "0.4.20" tracing = "0.1.40"
once_cell = "1.18.0" once_cell = "1.18.0"
parking_lot = "^0.12.1" parking_lot = "^0.12.1"

View file

@ -40,7 +40,7 @@ flate2 = "1.0.28"
futures = "0.3.29" futures = "0.3.29"
futures-lite = "2.0.1" futures-lite = "2.0.1"
futures-util = "0.3.29" futures-util = "0.3.29"
log = "0.4.20" tracing = "0.1.40"
serde = { version = "^1.0", features = ["serde_derive"] } serde = { version = "^1.0", features = ["serde_derive"] }
serde_json = "^1.0.108" serde_json = "^1.0.108"
thiserror = "1.0.50" thiserror = "1.0.50"

View file

@ -21,7 +21,6 @@ use azalea_protocol::{
read::ReadPacketError, read::ReadPacketError,
}; };
use futures::FutureExt; use futures::FutureExt;
use log::{error, info, warn};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::error::Error; use std::error::Error;
use tokio::{ use tokio::{
@ -29,6 +28,7 @@ use tokio::{
net::{TcpListener, TcpStream}, net::{TcpListener, TcpStream},
}; };
use tracing::Level; use tracing::Level;
use tracing::{error, info, warn};
const LISTEN_ADDR: &str = "127.0.0.1:25566"; const LISTEN_ADDR: &str = "127.0.0.1:25566";
const PROXY_ADDR: &str = "127.0.0.1:25565"; const PROXY_ADDR: &str = "127.0.0.1:25565";

View file

@ -15,7 +15,6 @@ use azalea_auth::game_profile::GameProfile;
use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError}; use azalea_auth::sessionserver::{ClientSessionServerError, ServerSessionServerError};
use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc}; use azalea_crypto::{Aes128CfbDec, Aes128CfbEnc};
use bytes::BytesMut; use bytes::BytesMut;
use log::{error, info};
use std::fmt::Debug; use std::fmt::Debug;
use std::io::Cursor; use std::io::Cursor;
use std::marker::PhantomData; use std::marker::PhantomData;
@ -24,6 +23,7 @@ use thiserror::Error;
use tokio::io::AsyncWriteExt; use tokio::io::AsyncWriteExt;
use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError}; use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf, ReuniteError};
use tokio::net::TcpStream; use tokio::net::TcpStream;
use tracing::{error, info};
use uuid::Uuid; use uuid::Uuid;
pub struct RawReadConnection { pub struct RawReadConnection {

View file

@ -3,8 +3,8 @@ use azalea_buf::{
}; };
use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation}; use azalea_core::{bitset::FixedBitSet, resource_location::ResourceLocation};
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use log::warn;
use std::io::{Cursor, Write}; use std::io::{Cursor, Write};
use tracing::warn;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)] #[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundCommandsPacket { pub struct ClientboundCommandsPacket {

View file

@ -9,7 +9,6 @@ use bytes::BytesMut;
use flate2::read::ZlibDecoder; use flate2::read::ZlibDecoder;
use futures::StreamExt; use futures::StreamExt;
use futures_lite::future; use futures_lite::future;
use log::{log_enabled, trace};
use std::backtrace::Backtrace; use std::backtrace::Backtrace;
use std::{ use std::{
fmt::Debug, fmt::Debug,
@ -18,6 +17,7 @@ use std::{
use thiserror::Error; use thiserror::Error;
use tokio::io::AsyncRead; use tokio::io::AsyncRead;
use tokio_util::codec::{BytesCodec, FramedRead}; use tokio_util::codec::{BytesCodec, FramedRead};
use tracing::if_log_enabled;
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum ReadPacketError { pub enum ReadPacketError {
@ -346,7 +346,7 @@ where
.map_err(ReadPacketError::from)?; .map_err(ReadPacketError::from)?;
} }
if log_enabled!(log::Level::Trace) { if_log_enabled!(tracing::Level::TRACE, {
let buf_string: String = { let buf_string: String = {
if buf.len() > 500 { if buf.len() > 500 {
let cut_off_buf = &buf[..500]; let cut_off_buf = &buf[..500];
@ -356,7 +356,7 @@ where
} }
}; };
trace!("Reading packet with bytes: {buf_string}"); trace!("Reading packet with bytes: {buf_string}");
} });
Ok(Some(buf)) Ok(Some(buf))
} }

View file

@ -4,10 +4,10 @@ use crate::{packets::ProtocolPacket, read::MAXIMUM_UNCOMPRESSED_LENGTH};
use async_compression::tokio::bufread::ZlibEncoder; use async_compression::tokio::bufread::ZlibEncoder;
use azalea_buf::McBufVarWritable; use azalea_buf::McBufVarWritable;
use azalea_crypto::Aes128CfbEnc; use azalea_crypto::Aes128CfbEnc;
use log::trace;
use std::fmt::Debug; use std::fmt::Debug;
use thiserror::Error; use thiserror::Error;
use tokio::io::{AsyncReadExt, AsyncWrite, AsyncWriteExt}; use tokio::io::{AsyncReadExt, AsyncWrite, AsyncWriteExt};
use tracing::trace;
/// Prepend the length of the packet to it. /// Prepend the length of the packet to it.
fn frame_prepender(mut data: Vec<u8>) -> Result<Vec<u8>, std::io::Error> { fn frame_prepender(mut data: Vec<u8>) -> Result<Vec<u8>, std::io::Error> {

View file

@ -20,7 +20,7 @@ azalea-registry = { path = "../azalea-registry", version = "0.8.0" }
bevy_ecs = "0.12.0" bevy_ecs = "0.12.0"
derive_more = { version = "0.99.17", features = ["deref", "deref_mut"] } derive_more = { version = "0.99.17", features = ["deref", "deref_mut"] }
enum-as-inner = "0.6.0" enum-as-inner = "0.6.0"
log = "0.4.20" tracing = "0.1.40"
nohash-hasher = "0.2.0" nohash-hasher = "0.2.0"
once_cell = "1.18.0" once_cell = "1.18.0"
parking_lot = "^0.12.1" parking_lot = "^0.12.1"

View file

@ -6,7 +6,6 @@ use azalea_block::BlockState;
use azalea_buf::{BufReadError, McBufReadable, McBufWritable}; use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos}; use azalea_core::position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos};
use azalea_nbt::NbtCompound; use azalea_nbt::NbtCompound;
use log::{debug, trace, warn};
use nohash_hasher::IntMap; use nohash_hasher::IntMap;
use parking_lot::RwLock; use parking_lot::RwLock;
use std::str::FromStr; use std::str::FromStr;
@ -16,6 +15,7 @@ use std::{
io::{Cursor, Write}, io::{Cursor, Write},
sync::{Arc, Weak}, sync::{Arc, Weak},
}; };
use tracing::{debug, trace, warn};
const SECTION_HEIGHT: u32 = 16; const SECTION_HEIGHT: u32 = 16;

View file

@ -1,13 +1,13 @@
use azalea_core::resource_location::ResourceLocation; use azalea_core::resource_location::ResourceLocation;
use bevy_ecs::{component::Component, system::Resource}; use bevy_ecs::{component::Component, system::Resource};
use derive_more::{Deref, DerefMut}; use derive_more::{Deref, DerefMut};
use log::error;
use nohash_hasher::IntMap; use nohash_hasher::IntMap;
use parking_lot::RwLock; use parking_lot::RwLock;
use std::{ use std::{
collections::HashMap, collections::HashMap,
sync::{Arc, Weak}, sync::{Arc, Weak},
}; };
use tracing::error;
use crate::{ChunkStorage, Instance}; use crate::{ChunkStorage, Instance};

View file

@ -31,7 +31,7 @@ bevy_tasks = { version = "0.12.0", features = ["multi-threaded"] }
derive_more = { version = "0.99.17", features = ["deref", "deref_mut"] } derive_more = { version = "0.99.17", features = ["deref", "deref_mut"] }
futures = "0.3.29" futures = "0.3.29"
futures-lite = "2.0.1" futures-lite = "2.0.1"
log = "0.4.20" tracing = "0.1.40"
nohash-hasher = "0.2.0" nohash-hasher = "0.2.0"
num-traits = "0.2.17" num-traits = "0.2.17"
parking_lot = { version = "^0.12.1", features = ["deadlock_detection"] } parking_lot = { version = "^0.12.1", features = ["deadlock_detection"] }

View file

@ -22,8 +22,8 @@ use bevy_app::{FixedUpdate, Update};
use bevy_ecs::prelude::Event; use bevy_ecs::prelude::Event;
use bevy_ecs::schedule::IntoSystemConfigs; use bevy_ecs::schedule::IntoSystemConfigs;
use futures_lite::Future; use futures_lite::Future;
use log::trace;
use std::f64::consts::PI; use std::f64::consts::PI;
use tracing::trace;
use crate::pathfinder::PathfinderPlugin; use crate::pathfinder::PathfinderPlugin;

View file

@ -5,9 +5,9 @@ use std::{
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use log::{debug, trace, warn};
use priority_queue::PriorityQueue; use priority_queue::PriorityQueue;
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use tracing::{debug, trace, warn};
pub struct Path<P, M> pub struct Path<P, M>
where where

View file

@ -41,11 +41,11 @@ use bevy_ecs::schedule::IntoSystemConfigs;
use bevy_ecs::system::{Local, ResMut}; use bevy_ecs::system::{Local, ResMut};
use bevy_tasks::{AsyncComputeTaskPool, Task}; use bevy_tasks::{AsyncComputeTaskPool, Task};
use futures_lite::future; use futures_lite::future;
use log::{debug, error, info, trace, warn};
use std::collections::VecDeque; use std::collections::VecDeque;
use std::sync::atomic::{self, AtomicUsize}; use std::sync::atomic::{self, AtomicUsize};
use std::sync::Arc; use std::sync::Arc;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use tracing::{debug, error, info, trace, warn};
use self::mining::MiningCache; use self::mining::MiningCache;
use self::moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn}; use self::moves::{ExecuteCtx, IsReachedCtx, SuccessorsFn};

View file

@ -16,11 +16,11 @@ use azalea_world::InstanceContainer;
use bevy_app::{App, PluginGroup, PluginGroupBuilder, Plugins}; use bevy_app::{App, PluginGroup, PluginGroupBuilder, Plugins};
use bevy_ecs::{component::Component, entity::Entity, system::Resource, world::World}; use bevy_ecs::{component::Component, entity::Entity, system::Resource, world::World};
use futures::future::{join_all, BoxFuture}; use futures::future::{join_all, BoxFuture};
use log::error;
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use std::{collections::HashMap, future::Future, net::SocketAddr, sync::Arc, time::Duration}; use std::{collections::HashMap, future::Future, net::SocketAddr, sync::Arc, time::Duration};
use thiserror::Error; use thiserror::Error;
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tracing::error;
use crate::{BoxHandleFn, DefaultBotPlugins, HandleFn, NoState}; use crate::{BoxHandleFn, DefaultBotPlugins, HandleFn, NoState};