Skip to content

Commit

Permalink
Merge pull request #1731 from tarkah/fix/debug-bytes
Browse files Browse the repository at this point in the history
Remove logging large bytes arrays
  • Loading branch information
hecrj authored Feb 23, 2023
2 parents 666f3cd + 07a7681 commit 573d27e
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 6 deletions.
2 changes: 1 addition & 1 deletion glow/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl std::fmt::Debug for Settings {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Settings")
// Instead of printing the font bytes, we simply show a `bool` indicating if using a default font or not.
.field("default_font", &self.default_font.is_none())
.field("default_font", &self.default_font.is_some())
.field("default_text_size", &self.default_text_size)
.field("text_multithreading", &self.text_multithreading)
.field("antialiasing", &self.antialiasing)
Expand Down
2 changes: 1 addition & 1 deletion glutin/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
settings.id,
);

log::info!("Window builder: {:#?}", builder);
log::debug!("Window builder: {:#?}", builder);

let opengl_builder = ContextBuilder::new()
.with_vsync(true)
Expand Down
8 changes: 7 additions & 1 deletion src/window/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ use std::io;
use std::path::Path;

/// The icon of a window.
#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct Icon(iced_winit::winit::window::Icon);

impl fmt::Debug for Icon {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Icon").field(&format_args!("_")).finish()
}
}

impl Icon {
/// Creates an icon from 32bpp RGBA data.
pub fn from_rgba(
Expand Down
18 changes: 17 additions & 1 deletion wgpu/src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//! Configure a renderer.
use std::fmt;

pub use crate::Antialiasing;

/// The settings of a [`Backend`].
///
/// [`Backend`]: crate::Backend
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Clone, Copy, PartialEq)]
pub struct Settings {
/// The present mode of the [`Backend`].
///
Expand Down Expand Up @@ -36,6 +38,20 @@ pub struct Settings {
pub antialiasing: Option<Antialiasing>,
}

impl fmt::Debug for Settings {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Settings")
.field("present_mode", &self.present_mode)
.field("internal_backend", &self.internal_backend)
// Instead of printing the font bytes, we simply show a `bool` indicating if using a default font or not.
.field("default_font", &self.default_font.is_some())
.field("default_text_size", &self.default_text_size)
.field("text_multithreading", &self.text_multithreading)
.field("antialiasing", &self.antialiasing)
.finish()
}
}

impl Settings {
/// Creates new [`Settings`] using environment configuration.
///
Expand Down
2 changes: 1 addition & 1 deletion winit/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ where
)
.with_visible(false);

log::info!("Window builder: {:#?}", builder);
log::debug!("Window builder: {:#?}", builder);

let window = builder
.build(&event_loop)
Expand Down
23 changes: 22 additions & 1 deletion winit/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ pub use platform::PlatformSpecific;

use crate::conversion;
use crate::Position;

use winit::monitor::MonitorHandle;
use winit::window::WindowBuilder;

use std::fmt;

/// The settings of an application.
#[derive(Debug, Clone, Default)]
pub struct Settings<Flags> {
Expand Down Expand Up @@ -59,7 +62,7 @@ pub struct Settings<Flags> {
}

/// The window settings of an application.
#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct Window {
/// The size of the window.
pub size: (u32, u32),
Expand Down Expand Up @@ -95,6 +98,24 @@ pub struct Window {
pub platform_specific: platform::PlatformSpecific,
}

impl fmt::Debug for Window {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Window")
.field("size", &self.size)
.field("position", &self.position)
.field("min_size", &self.min_size)
.field("max_size", &self.max_size)
.field("visible", &self.visible)
.field("resizable", &self.resizable)
.field("decorations", &self.decorations)
.field("transparent", &self.transparent)
.field("always_on_top", &self.always_on_top)
.field("icon", &self.icon.is_some())
.field("platform_specific", &self.platform_specific)
.finish()
}
}

impl Window {
/// Converts the window settings into a `WindowBuilder` from `winit`.
pub fn into_builder(
Expand Down

0 comments on commit 573d27e

Please sign in to comment.