Skip to content

Commit

Permalink
Reduce logging verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshiew committed Dec 5, 2024
1 parent b0c03df commit fee2adc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion crates/common/src/extras/worldgen/mountain_islands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl MountainIslands {
horizontal_smoothness: CHUNK_SIZE_F64 * 0.1,
trees: default_trees(seed),
};
tracing::info!(?wgen.heightmap.octaves, wgen.heightmap.frequency, wgen.heightmap.lacunarity, wgen.heightmap.persistence, "MountainIslands initialized");
tracing::debug!(?wgen.heightmap.octaves, wgen.heightmap.frequency, wgen.heightmap.lacunarity, wgen.heightmap.persistence, "MountainIslands initialized");
wgen
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub fn mesh_chunk_visible_block_faces(
}
},
None => {
tracing::warn!(
tracing::error!(
?chunk_block_id,
?block_face,
"No appearance defined for block face"
Expand Down
2 changes: 1 addition & 1 deletion crates/infinigen/src/assets/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl BlockMappings {

pub fn add(&mut self, block_definition: BlockDefinition) -> ChunkBlockId {
let mapped_id = self.next_free_mapped_id;
tracing::info!(?block_definition, ?mapped_id, "Mapping block");
tracing::debug!(?block_definition, ?mapped_id, "Mapping block");
self.by_block_id
.insert(block_definition.id.clone(), self.next_free_mapped_id);
self.by_mapped_id
Expand Down
22 changes: 11 additions & 11 deletions crates/infinigen/src/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn skip_loading_assets(mut next_state: ResMut<NextState<AppState>>) {
pub fn load_assets(mut registry: ResMut<BlockRegistry>, asset_server: Res<AssetServer>) {
registry.block_texture_folder = asset_server.load_folder("blocks/textures/");
registry.block_definition_folder = asset_server.load_folder("blocks/types/");
tracing::info!(
tracing::debug!(
"Loading assets: textures: {}, block definitions: {}",
registry.block_texture_folder.path().unwrap(),
registry.block_definition_folder.path().unwrap(),
Expand All @@ -53,22 +53,22 @@ pub fn check_assets(
let blockdef_load_state =
asset_server.get_recursive_dependency_load_state(&registry.block_definition_folder);
if let Some(RecursiveDependencyLoadState::Loaded) = blockdef_load_state {
tracing::info!("Finished loading block definitions");
tracing::debug!("Finished loading block definitions");
block_definitions_loaded = true;
}

let mut block_textures_loaded = false;
let blocktex_load_state =
asset_server.get_recursive_dependency_load_state(&registry.block_texture_folder);
if let Some(RecursiveDependencyLoadState::Loaded) = blocktex_load_state {
tracing::info!("Finished loading block textures");
tracing::debug!("Finished loading block textures");
block_textures_loaded = true;
}

if block_definitions_loaded && block_textures_loaded {
next_state.set(AppState::InitializingRegistry);
} else {
tracing::info!(
tracing::debug!(
"Loading block definitions: {:?}, block textures: {:?}",
blockdef_load_state,
blocktex_load_state
Expand Down Expand Up @@ -98,24 +98,24 @@ pub fn setup(
let handle = handle.clone_weak().typed();
let path = asset_server.get_path(handle.id());
if let Some(texture) = textures.get(&handle) {
tracing::info!(?path, "Texture found");
tracing::debug!(?path, "Texture found");
let path = path.unwrap();
let name = path.path().file_name().unwrap().to_str().unwrap();
let name = name.trim_end_matches(".png");

block_texture_handles_by_name.insert(name.to_owned(), handle.clone_weak());
block_tatlas_builder.add_texture(Some(handle.id()), texture);
} else {
tracing::warn!("{:?} did not resolve to an `Image` asset.", path,);
tracing::error!("{:?} did not resolve to an `Image` asset.", path,);
panic!();
};
}
let (atlas_layout, atlas_sources, texture_atlas) = block_tatlas_builder.build().unwrap();
tracing::info!(?atlas_layout.size, ?atlas_layout.textures, "Stitched texture atlas");
tracing::debug!(?atlas_layout.size, ?atlas_layout.textures, "Stitched texture atlas");
let texture_atlas = textures.add(texture_atlas);
(Some(atlas_sources), Some(atlas_layout), Some(texture_atlas))
} else {
tracing::warn!("Block textures were not loaded");
tracing::warn!("Block textures were not loaded, falling back to colours");
(None, None, None)
};

Expand All @@ -130,15 +130,15 @@ pub fn setup(
.cloned()
.collect();
if block_definitions.is_empty() {
tracing::warn!("No block definition files found, falling back to defaults");
tracing::warn!("No block definition files found, falling back to default definitions");
block_definitions = default_block_definitions();
}
// map block definitions in alphabetical order by ID
// so for the same set of block definitions, we should get the same mapping
block_definitions.sort();

for block_definition in block_definitions {
tracing::info!(?block_definition, "Block definition found");
tracing::debug!(?block_definition, "Block definition found");
// default to color in case texture is missing
let mut faces = [FaceAppearance::Color {
r: block_definition.color[0] as f32 / 256.,
Expand All @@ -154,7 +154,7 @@ pub fn setup(
let texture_handle = block_texture_handles_by_name
.get(texture_file_names.get(&face).unwrap())
.unwrap();
tracing::info!(?face, ?block_definition.id, "Found specific texture");
tracing::debug!(?face, ?block_definition.id, "Found specific texture");
let tidx = atlas_sources.texture_index(texture_handle).unwrap();
let tidx = FaceAppearance::Texture {
coords: [
Expand Down
8 changes: 4 additions & 4 deletions crates/infinigen/src/scene/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ pub fn process_load_chunk_ops(
continue;
}
Some(ChunkStatus::Generated(chunk_info)) => {
tracing::debug!(?cpos, "Will render chunk");
tracing::trace!(?cpos, "Will render chunk");

let Chunk::Unpacked(ref chunk) = chunk_info.chunk else {
tracing::debug!(?cpos, "Empty chunk");
tracing::trace!(?cpos, "Empty chunk");
continue;
};
let mut opaque_chunk = chunk.to_owned();
Expand Down Expand Up @@ -161,7 +161,7 @@ pub fn process_load_chunk_ops(
};

if loads.is_empty() {
tracing::debug!(?cpos, "Occluded chunk");
tracing::trace!(?cpos, "Occluded chunk");
continue;
}

Expand All @@ -187,7 +187,7 @@ pub fn process_load_chunk_ops(
.set_parent(cid);
}

tracing::debug!(?cpos, "Chunk loaded");
tracing::trace!(?cpos, "Chunk loaded");
}
Some(ChunkStatus::Meshed { .. }) => todo!(),
}
Expand Down

0 comments on commit fee2adc

Please sign in to comment.