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

refactor: remove println statements (#31)

This PR removes all println statements and logs them on trace level instead. Normally, libraries shouldn't print to stdout using println, since there's no control over them.
This commit is contained in:
Sculas 2022-10-17 20:18:25 +02:00 committed by GitHub
parent 96e94aa424
commit d4d4ba054f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View file

@ -71,7 +71,7 @@ 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> {
println!("saving cache: {:?}", cache); log::trace!("saving cache: {:?}", cache);
let mut cache_file = File::create(cache_file).await.map_err(CacheError::Write)?; let mut cache_file = File::create(cache_file).await.map_err(CacheError::Write)?;
let cache = serde_json::to_string_pretty(&cache).map_err(CacheError::Parse)?; let cache = serde_json::to_string_pretty(&cache).map_err(CacheError::Parse)?;

View file

@ -51,7 +51,6 @@ pub async fn join(
"selectedProfile": undashed_uuid, "selectedProfile": undashed_uuid,
"serverId": server_hash "serverId": server_hash
}); });
println!("data: {:?}", data);
let res = client let res = client
.post("https://sessionserver.mojang.com/session/minecraft/join") .post("https://sessionserver.mojang.com/session/minecraft/join")
.json(&data) .json(&data)

View file

@ -231,7 +231,6 @@ impl<S> CommandDispatcher<S> {
for context in contexts.iter() { for context in contexts.iter() {
let child = &context.child; let child = &context.child;
if let Some(child) = child { if let Some(child) = child {
println!("aaaaaaa {:?}", child);
forked |= child.forks; forked |= child.forks;
if child.has_nodes() { if child.has_nodes() {
found_command = true; found_command = true;

View file

@ -144,9 +144,10 @@ impl Client {
let mut entity = player let mut entity = player
.entity_mut(&mut dimension_lock) .entity_mut(&mut dimension_lock)
.ok_or(MovePlayerError::PlayerNotInWorld)?; .ok_or(MovePlayerError::PlayerNotInWorld)?;
println!( log::trace!(
"move entity bounding box: {} {:?}", "move entity bounding box: {} {:?}",
entity.id, entity.bounding_box entity.id,
entity.bounding_box
); );
entity.move_colliding(&MoverType::Own, movement)?; entity.move_colliding(&MoverType::Own, movement)?;

View file

@ -104,7 +104,7 @@ impl ChunkStorage {
data: &mut Cursor<&[u8]>, data: &mut Cursor<&[u8]>,
) -> Result<(), BufReadError> { ) -> Result<(), BufReadError> {
if !self.in_range(pos) { if !self.in_range(pos) {
println!( log::trace!(
"Ignoring chunk since it's not in the view range: {}, {}", "Ignoring chunk since it's not in the view range: {}, {}",
pos.x, pos.z pos.x, pos.z
); );
@ -115,7 +115,8 @@ impl ChunkStorage {
data, data,
self.height, self.height,
)?)); )?));
println!("Loaded chunk {:?}", pos);
log::trace!("Loaded chunk {:?}", pos);
self[pos] = Some(chunk); self[pos] = Some(chunk);
Ok(()) Ok(())