Replace println! with log crate facade macros info!, debug!, etc.
This commit is contained in:
parent
8071db668c
commit
fd028d41b0
|
@ -166,7 +166,7 @@ macro_rules! define_blocks {
|
|||
if let Some(blocks_by_data) = VANILLA_ID_MAP.modded.get(name) {
|
||||
blocks_by_data[data].unwrap_or(Block::Missing{})
|
||||
} else {
|
||||
//println!("Modded block not supported yet: {}:{} -> {}", id >> 4, data, name);
|
||||
//info!("Modded block not supported yet: {}:{} -> {}", id >> 4, data, name);
|
||||
Block::Missing{}
|
||||
}
|
||||
} else {
|
||||
|
@ -415,9 +415,9 @@ macro_rules! define_blocks {
|
|||
let id = flat_id + offset;
|
||||
/*
|
||||
if let Some(vanilla_id) = vanilla_id {
|
||||
println!("{} block state = {:?} hierarchical {}:{} offset={}", id, block, vanilla_id >> 4, vanilla_id & 0xF, offset);
|
||||
debug!("{} block state = {:?} hierarchical {}:{} offset={}", id, block, vanilla_id >> 4, vanilla_id & 0xF, offset);
|
||||
} else {
|
||||
println!("{} block state = {:?} hierarchical none, offset={}", id, block, offset);
|
||||
debug!("{} block state = {:?} hierarchical none, offset={}", id, block, offset);
|
||||
}
|
||||
*/
|
||||
if offset as isize > last_offset {
|
||||
|
@ -442,7 +442,7 @@ macro_rules! define_blocks {
|
|||
if let Some(vanilla_id) = vanilla_id {
|
||||
/*
|
||||
if offset.is_none() {
|
||||
println!("(no flat) block state = {:?} hierarchical {}:{}", block, vanilla_id >> 4, vanilla_id & 0xF);
|
||||
debug!("(no flat) block state = {:?} hierarchical {}:{}", block, vanilla_id >> 4, vanilla_id & 0xF);
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ impl ecs::System for MovementHandler {
|
|||
let dt = movement.when_last_jump_pressed.unwrap() - movement.when_last_jump_released.unwrap();
|
||||
if dt.as_secs() == 0 && dt.subsec_millis() <= crate::settings::DOUBLE_JUMP_MS {
|
||||
movement.want_to_fly = !movement.want_to_fly;
|
||||
//println!("double jump! dt={:?} toggle want_to_fly = {}", dt, movement.want_to_fly);
|
||||
//info!("double jump! dt={:?} toggle want_to_fly = {}", dt, movement.want_to_fly);
|
||||
|
||||
if gamemode.can_fly() && !gamemode.always_fly() {
|
||||
movement.flying = movement.want_to_fly;
|
||||
|
|
|
@ -19,6 +19,7 @@ use std::ffi;
|
|||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use log::{error, info};
|
||||
|
||||
/// Inits the gl library. This should be called once a context is ready.
|
||||
pub fn init(vid: & glutin::WindowedContext<glutin::PossiblyCurrent>) {
|
||||
|
@ -373,7 +374,7 @@ impl Texture {
|
|||
gl::GetIntegerv(gl::MAX_SAMPLES, &mut result[0]);
|
||||
let use_samples =
|
||||
if samples > result[0] {
|
||||
println!("glTexImage2DMultisample: requested {} samples but GL_MAX_SAMPLES is {}", samples, result[0]);
|
||||
info!("glTexImage2DMultisample: requested {} samples but GL_MAX_SAMPLES is {}", samples, result[0]);
|
||||
result[0]
|
||||
} else {
|
||||
samples
|
||||
|
@ -848,7 +849,6 @@ pub fn check_framebuffer_status() {
|
|||
};
|
||||
|
||||
if status != gl::FRAMEBUFFER_COMPLETE {
|
||||
println!("glBindFramebuffer failed, glCheckFrameBufferStatus(GL_FRAMEBUFFER) = {} {}", status, s);
|
||||
panic!("glBindFramebuffer failed, glCheckFrameBufferStatus(GL_FRAMEBUFFER) = {} {}", status, s);
|
||||
}
|
||||
}
|
||||
|
@ -862,7 +862,7 @@ pub fn check_gl_error() {
|
|||
break
|
||||
}
|
||||
|
||||
println!("glGetError = {}", err);
|
||||
error!("glGetError = {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#![recursion_limit="300"]
|
||||
|
||||
use std::time::{Instant, Duration};
|
||||
use log::{info, warn};
|
||||
use log::{info, warn, error};
|
||||
extern crate steven_shared as shared;
|
||||
|
||||
use structopt::StructOpt;
|
||||
|
@ -316,7 +316,7 @@ pub fn main() {
|
|||
|
||||
let vsync_changed = *game.vars.get(settings::R_VSYNC);
|
||||
if vsync != vsync_changed {
|
||||
println!("Changing vsync currently requires restarting");
|
||||
error!("Changing vsync currently requires restarting");
|
||||
break;
|
||||
// TODO: after https://github.com/tomaka/glutin/issues/693 Allow changing vsync on a Window
|
||||
//vsync = vsync_changed;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
/// Implements https://wiki.vg/Minecraft_Forge_Handshake
|
||||
use std::io;
|
||||
use byteorder::WriteBytesExt;
|
||||
use log::debug;
|
||||
|
||||
use crate::protocol::{Serializable, Error, LenPrefixed, VarInt};
|
||||
|
||||
|
@ -132,7 +133,7 @@ impl Serializable for FmlHs {
|
|||
None
|
||||
};
|
||||
|
||||
println!("FML|HS ServerHello: fml_protocol_version={}, override_dimension={:?}", fml_protocol_version, override_dimension);
|
||||
debug!("FML|HS ServerHello: fml_protocol_version={}, override_dimension={:?}", fml_protocol_version, override_dimension);
|
||||
|
||||
Ok(FmlHs::ServerHello {
|
||||
fml_protocol_version,
|
||||
|
|
|
@ -38,6 +38,7 @@ use flate2::read::{ZlibDecoder, ZlibEncoder};
|
|||
use flate2::Compression;
|
||||
use std::time::{Instant, Duration};
|
||||
use crate::shared::Position;
|
||||
use log::debug;
|
||||
|
||||
pub const SUPPORTED_PROTOCOLS: [i32; 14] = [480, 477, 452, 451, 404, 340, 316, 315, 210, 109, 107, 74, 47, 5];
|
||||
|
||||
|
@ -1021,7 +1022,7 @@ impl Conn {
|
|||
write.read_to_end(&mut new)?;
|
||||
let network_debug = unsafe { NETWORK_DEBUG };
|
||||
if network_debug {
|
||||
println!("Compressed for sending {} bytes to {} since > threshold {}, new={:?}",
|
||||
debug!("Compressed for sending {} bytes to {} since > threshold {}, new={:?}",
|
||||
uncompressed_size, new.len(), self.compression_threshold,
|
||||
new);
|
||||
}
|
||||
|
@ -1054,7 +1055,7 @@ impl Conn {
|
|||
reader.read_to_end(&mut new)?;
|
||||
}
|
||||
if network_debug {
|
||||
println!("Decompressed threshold={} len={} uncompressed_size={} to {} bytes",
|
||||
debug!("Decompressed threshold={} len={} uncompressed_size={} to {} bytes",
|
||||
self.compression_threshold, len, uncompressed_size, new.len());
|
||||
}
|
||||
buf = io::Cursor::new(new);
|
||||
|
@ -1068,14 +1069,14 @@ impl Conn {
|
|||
};
|
||||
|
||||
if network_debug {
|
||||
println!("about to parse id={:x}, dir={:?} state={:?}", id, dir, self.state);
|
||||
debug!("about to parse id={:x}, dir={:?} state={:?}", id, dir, self.state);
|
||||
std::fs::File::create("last-packet")?.write_all(buf.get_ref())?;
|
||||
}
|
||||
|
||||
let packet = packet::packet_by_id(self.protocol_version, self.state, dir, id, &mut buf)?;
|
||||
|
||||
if network_debug {
|
||||
println!("packet = {:?}", packet);
|
||||
debug!("packet = {:?}", packet);
|
||||
}
|
||||
|
||||
match packet {
|
||||
|
|
|
@ -5,6 +5,7 @@ use cgmath::{Point3, Matrix4};
|
|||
use byteorder::{WriteBytesExt, NativeEndian};
|
||||
use crate::gl;
|
||||
use super::glsl;
|
||||
use log::error;
|
||||
|
||||
pub struct Clouds {
|
||||
program: gl::Program,
|
||||
|
@ -47,13 +48,13 @@ impl Clouds {
|
|||
v.compile();
|
||||
|
||||
if v.get_parameter(gl::COMPILE_STATUS) == 0 {
|
||||
println!("Src: {}", vertex);
|
||||
error!("Src: {}", vertex);
|
||||
panic!("Shader error: {}", v.get_info_log());
|
||||
} else {
|
||||
let log = v.get_info_log();
|
||||
let log = log.trim().trim_matches('\u{0}');
|
||||
if !log.is_empty() {
|
||||
println!("{}", log);
|
||||
error!("{}", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,13 +63,13 @@ impl Clouds {
|
|||
g.compile();
|
||||
|
||||
if g.get_parameter(gl::COMPILE_STATUS) == 0 {
|
||||
println!("Src: {}", geo);
|
||||
error!("Src: {}", geo);
|
||||
panic!("Shader error: {}", g.get_info_log());
|
||||
} else {
|
||||
let log = g.get_info_log();
|
||||
let log = log.trim().trim_matches('\u{0}');
|
||||
if !log.is_empty() {
|
||||
println!("{}", log);
|
||||
error!("{}", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,13 +78,13 @@ impl Clouds {
|
|||
f.compile();
|
||||
|
||||
if f.get_parameter(gl::COMPILE_STATUS) == 0 {
|
||||
println!("Src: {}", fragment);
|
||||
error!("Src: {}", fragment);
|
||||
panic!("Shader error: {}", f.get_info_log());
|
||||
} else {
|
||||
let log = f.get_info_log();
|
||||
let log = log.trim().trim_matches('\u{0}');
|
||||
if !log.is_empty() {
|
||||
println!("{}", log);
|
||||
error!("{}", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
use crate::render::glsl;
|
||||
use crate::gl;
|
||||
use log::error;
|
||||
|
||||
pub fn add_shaders(reg: &mut glsl::Registry) {
|
||||
reg.register("lookup_texture", include_str!("shaders/lookup_texture.glsl"));
|
||||
|
@ -128,13 +129,13 @@ pub fn create_program(vertex: &str, fragment: &str) -> gl::Program {
|
|||
v.compile();
|
||||
|
||||
if v.get_parameter(gl::COMPILE_STATUS) == 0 {
|
||||
println!("Src: {}", vertex);
|
||||
error!("Src: {}", vertex);
|
||||
panic!("Shader error: {}", v.get_info_log());
|
||||
} else {
|
||||
let log = v.get_info_log();
|
||||
let log = log.trim().trim_matches('\u{0}');
|
||||
if !log.is_empty() {
|
||||
println!("{}", log);
|
||||
error!("{}", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,13 +144,13 @@ pub fn create_program(vertex: &str, fragment: &str) -> gl::Program {
|
|||
f.compile();
|
||||
|
||||
if f.get_parameter(gl::COMPILE_STATUS) == 0 {
|
||||
println!("Src: {}", fragment);
|
||||
error!("Src: {}", fragment);
|
||||
panic!("Shader error: {}", f.get_info_log());
|
||||
} else {
|
||||
let log = f.get_info_log();
|
||||
let log = log.trim().trim_matches('\u{0}');
|
||||
if !log.is_empty() {
|
||||
println!("{}", log);
|
||||
error!("{}", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -684,7 +684,7 @@ impl Server {
|
|||
|
||||
fn on_plugin_message_clientbound(&mut self, channel: &str, data: &[u8]) {
|
||||
if unsafe { protocol::NETWORK_DEBUG } {
|
||||
println!("Received plugin message: channel={}, data={:?}", channel, data);
|
||||
debug!("Received plugin message: channel={}, data={:?}", channel, data);
|
||||
}
|
||||
|
||||
match channel {
|
||||
|
@ -692,13 +692,13 @@ impl Server {
|
|||
// TODO: "UNREGISTER" =>
|
||||
"FML|HS" => {
|
||||
let msg = crate::protocol::Serializable::read_from(&mut std::io::Cursor::new(data)).unwrap();
|
||||
println!("FML|HS msg={:?}", msg);
|
||||
//debug!("FML|HS msg={:?}", msg);
|
||||
|
||||
use forge::FmlHs::*;
|
||||
use forge::Phase::*;
|
||||
match msg {
|
||||
ServerHello { fml_protocol_version, override_dimension } => {
|
||||
println!("Received FML|HS ServerHello {} {:?}", fml_protocol_version, override_dimension);
|
||||
debug!("Received FML|HS ServerHello {} {:?}", fml_protocol_version, override_dimension);
|
||||
|
||||
self.write_plugin_message("REGISTER", "FML|HS\0FML\0FML|MP\0FML\0FORGE".as_bytes());
|
||||
self.write_fmlhs_plugin_message(&ClientHello { fml_protocol_version });
|
||||
|
@ -707,12 +707,12 @@ impl Server {
|
|||
self.write_fmlhs_plugin_message(&ModList { mods });
|
||||
},
|
||||
ModList { mods } => {
|
||||
println!("Received FML|HS ModList: {:?}", mods);
|
||||
debug!("Received FML|HS ModList: {:?}", mods);
|
||||
|
||||
self.write_fmlhs_plugin_message(&HandshakeAck { phase: WaitingServerData });
|
||||
},
|
||||
ModIdData { mappings, block_substitutions: _, item_substitutions: _ } => {
|
||||
println!("Received FML|HS ModIdData");
|
||||
debug!("Received FML|HS ModIdData");
|
||||
for m in mappings.data {
|
||||
let (namespace, name) = m.name.split_at(1);
|
||||
if namespace == protocol::forge::BLOCK_NAMESPACE {
|
||||
|
@ -722,7 +722,7 @@ impl Server {
|
|||
self.write_fmlhs_plugin_message(&HandshakeAck { phase: WaitingServerComplete });
|
||||
},
|
||||
RegistryData { has_more, name, ids, substitutions: _, dummies: _ } => {
|
||||
println!("Received FML|HS RegistryData for {}", name);
|
||||
debug!("Received FML|HS RegistryData for {}", name);
|
||||
if name == "minecraft:blocks" {
|
||||
for m in ids.data {
|
||||
self.world.modded_block_ids.insert(m.id.0 as usize, m.name);
|
||||
|
@ -738,7 +738,7 @@ impl Server {
|
|||
self.write_fmlhs_plugin_message(&HandshakeAck { phase: PendingComplete });
|
||||
},
|
||||
Complete => {
|
||||
println!("FML|HS handshake complete!");
|
||||
debug!("FML|HS handshake complete!");
|
||||
},
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
|
@ -761,7 +761,7 @@ impl Server {
|
|||
|
||||
fn write_plugin_message(&mut self, channel: &str, data: &[u8]) {
|
||||
if unsafe { protocol::NETWORK_DEBUG } {
|
||||
println!("Sending plugin message: channel={}, data={:?}", channel, data);
|
||||
debug!("Sending plugin message: channel={}, data={:?}", channel, data);
|
||||
}
|
||||
if self.protocol_version >= 47 {
|
||||
self.write_packet(packet::play::serverbound::PluginMessageServerbound {
|
||||
|
|
Loading…
Reference in New Issue