core: Switch from log to tracing

This commit is contained in:
Nathan Adams 2023-01-04 11:09:47 +01:00
parent d6b8d6e488
commit 13fd830e7c
64 changed files with 230 additions and 218 deletions

2
Cargo.lock generated
View File

@ -3374,7 +3374,6 @@ dependencies = [
"generational-arena", "generational-arena",
"indexmap", "indexmap",
"instant", "instant",
"log",
"lzma-rs", "lzma-rs",
"nellymoser-rs", "nellymoser-rs",
"num-derive", "num-derive",
@ -3395,6 +3394,7 @@ dependencies = [
"swf", "swf",
"symphonia", "symphonia",
"thiserror", "thiserror",
"tracing",
"url", "url",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"weak-table", "weak-table",

View File

@ -15,7 +15,7 @@ fnv = "1.0.7"
gc-arena = { git = "https://github.com/ruffle-rs/gc-arena" } gc-arena = { git = "https://github.com/ruffle-rs/gc-arena" }
generational-arena = "0.2.8" generational-arena = "0.2.8"
indexmap = "1.9.2" indexmap = "1.9.2"
log = "0.4" tracing = "0.1.37"
ruffle_render = { path = "../render" } ruffle_render = { path = "../render" }
ruffle_video = { path = "../video" } ruffle_video = { path = "../video" }
ruffle_macros = { path = "macros" } ruffle_macros = { path = "macros" }

View File

@ -46,9 +46,9 @@ pub use value::Value;
macro_rules! avm_warn { macro_rules! avm_warn {
($activation: ident, $($arg:tt)*) => ( ($activation: ident, $($arg:tt)*) => (
if cfg!(feature = "avm_debug") { if cfg!(feature = "avm_debug") {
log::warn!("{} -- in {}", format!($($arg)*), $activation.id) tracing::warn!("{} -- in {}", format!($($arg)*), $activation.id)
} else { } else {
log::warn!($($arg)*) tracing::warn!($($arg)*)
} }
) )
} }
@ -57,9 +57,9 @@ macro_rules! avm_warn {
macro_rules! avm_error { macro_rules! avm_error {
($activation: ident, $($arg:tt)*) => ( ($activation: ident, $($arg:tt)*) => (
if cfg!(feature = "avm_debug") { if cfg!(feature = "avm_debug") {
log::error!("{} -- in {}", format!($($arg)*), $activation.id) tracing::error!("{} -- in {}", format!($($arg)*), $activation.id)
} else { } else {
log::error!($($arg)*) tracing::error!($($arg)*)
} }
) )
} }

View File

@ -31,7 +31,7 @@ use url::form_urlencoded;
macro_rules! avm_debug { macro_rules! avm_debug {
($avm: expr, $($arg:tt)*) => ( ($avm: expr, $($arg:tt)*) => (
if $avm.show_debug_output() { if $avm.show_debug_output() {
log::debug!($($arg)*) tracing::debug!($($arg)*)
} }
) )
} }

View File

@ -341,7 +341,7 @@ pub fn clear_interval<'gc>(
.unwrap_or(&Value::Undefined) .unwrap_or(&Value::Undefined)
.coerce_to_i32(activation)?; .coerce_to_i32(activation)?;
if !activation.context.timers.remove(id) { if !activation.context.timers.remove(id) {
log::info!("clearInterval: Timer {} does not exist", id); tracing::info!("clearInterval: Timer {} does not exist", id);
} }
Ok(Value::Undefined) Ok(Value::Undefined)
@ -357,7 +357,7 @@ pub fn clear_timeout<'gc>(
.unwrap_or(&Value::Undefined) .unwrap_or(&Value::Undefined)
.coerce_to_i32(activation)?; .coerce_to_i32(activation)?;
if !activation.context.timers.remove(id) { if !activation.context.timers.remove(id) {
log::info!("clearTimeout: Timer {} does not exist", id); tracing::info!("clearTimeout: Timer {} does not exist", id);
} }
Ok(Value::Undefined) Ok(Value::Undefined)

View File

@ -17,7 +17,7 @@ pub fn is_active<'gc>(
_this: Object<'gc>, _this: Object<'gc>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Accessibility.isActive: not yet implemented"); tracing::warn!("Accessibility.isActive: not yet implemented");
Ok(Value::Bool(false)) Ok(Value::Bool(false))
} }
@ -26,7 +26,7 @@ pub fn send_event<'gc>(
_this: Object<'gc>, _this: Object<'gc>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Accessibility.sendEvent: not yet implemented"); tracing::warn!("Accessibility.sendEvent: not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -35,7 +35,7 @@ pub fn update_properties<'gc>(
_this: Object<'gc>, _this: Object<'gc>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Accessibility.updateProperties: not yet implemented"); tracing::warn!("Accessibility.updateProperties: not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -72,7 +72,7 @@ pub fn constructor<'gc>(
.coerce_to_i32(activation)?; .coerce_to_i32(activation)?;
if !is_size_valid(activation.swf_version(), width, height) { if !is_size_valid(activation.swf_version(), width, height) {
log::warn!("Invalid BitmapData size: {}x{}", width, height); tracing::warn!("Invalid BitmapData size: {}x{}", width, height);
return Ok(Value::Undefined); return Ok(Value::Undefined);
} }
@ -517,12 +517,12 @@ pub fn draw<'gc>(
{ {
blend_mode = mode; blend_mode = mode;
} else { } else {
log::error!("Unknown blend mode {:?}", mode); tracing::error!("Unknown blend mode {:?}", mode);
} }
} }
if args.get(4).is_some() { if args.get(4).is_some() {
log::warn!("BitmapData.draw with clip rect - not implemented") tracing::warn!("BitmapData.draw with clip rect - not implemented")
} }
let smoothing = args let smoothing = args
.get(5) .get(5)
@ -571,7 +571,7 @@ pub fn apply_filter<'gc>(
_this: Object<'gc>, _this: Object<'gc>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("BitmapData.applyFilter - not yet implemented"); tracing::warn!("BitmapData.applyFilter - not yet implemented");
Ok((-1).into()) Ok((-1).into())
} }
@ -582,7 +582,7 @@ pub fn generate_filter_rect<'gc>(
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
if let Some(bitmap_data) = this.as_bitmap_data_object() { if let Some(bitmap_data) = this.as_bitmap_data_object() {
if !bitmap_data.disposed() { if !bitmap_data.disposed() {
log::warn!("BitmapData.generateFilterRect - not yet implemented"); tracing::warn!("BitmapData.generateFilterRect - not yet implemented");
return Ok(Value::Undefined); return Ok(Value::Undefined);
} }
} }
@ -746,7 +746,7 @@ pub fn hit_test<'gc>(
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
if let Some(bitmap_data) = this.as_bitmap_data_object() { if let Some(bitmap_data) = this.as_bitmap_data_object() {
if !bitmap_data.disposed() { if !bitmap_data.disposed() {
log::warn!("BitmapData.hitTest - not yet implemented"); tracing::warn!("BitmapData.hitTest - not yet implemented");
return Ok(Value::Undefined); return Ok(Value::Undefined);
} }
} }
@ -1079,7 +1079,7 @@ pub fn pixel_dissolve<'gc>(
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
if let Some(bitmap_data) = this.as_bitmap_data_object() { if let Some(bitmap_data) = this.as_bitmap_data_object() {
if !bitmap_data.disposed() { if !bitmap_data.disposed() {
log::warn!("BitmapData.pixelDissolve - not yet implemented"); tracing::warn!("BitmapData.pixelDissolve - not yet implemented");
return Ok(Value::Undefined); return Ok(Value::Undefined);
} }
} }
@ -1122,7 +1122,7 @@ pub fn threshold<'gc>(
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
if let Some(bitmap_data) = this.as_bitmap_data_object() { if let Some(bitmap_data) = this.as_bitmap_data_object() {
if !bitmap_data.disposed() { if !bitmap_data.disposed() {
log::warn!("BitmapData.threshold - not yet implemented"); tracing::warn!("BitmapData.threshold - not yet implemented");
return Ok(Value::Undefined); return Ok(Value::Undefined);
} }
} }

View File

@ -115,7 +115,7 @@ fn set_blend_mode<'gc>(
if let Ok(mode) = BlendMode::from_str(&mode.to_string()) { if let Ok(mode) = BlendMode::from_str(&mode.to_string()) {
this.set_blend_mode(activation.context.gc_context, mode); this.set_blend_mode(activation.context.gc_context, mode);
} else { } else {
log::error!("Unknown blend mode {}", mode); tracing::error!("Unknown blend mode {}", mode);
}; };
} }
Ok(()) Ok(())

View File

@ -30,7 +30,7 @@ pub fn domain<'gc>(
"localhost".into() "localhost".into()
} }
} else { } else {
log::error!("LocalConnection::domain: Unable to parse movie URL"); tracing::error!("LocalConnection::domain: Unable to parse movie URL");
return Ok(Value::Null); return Ok(Value::Null);
} }
} else { } else {

View File

@ -1480,7 +1480,7 @@ fn set_blend_mode<'gc>(
if let Ok(mode) = BlendMode::from_str(&mode.to_string()) { if let Ok(mode) = BlendMode::from_str(&mode.to_string()) {
this.set_blend_mode(activation.context.gc_context, mode); this.set_blend_mode(activation.context.gc_context, mode);
} else { } else {
log::error!("Unknown blend mode {}", mode); tracing::error!("Unknown blend mode {}", mode);
}; };
} }
Ok(()) Ok(())

View File

@ -228,7 +228,7 @@ pub fn get_local<'gc>(
const INVALID_CHARS: &str = "~%&\\;:\"',<>?# "; const INVALID_CHARS: &str = "~%&\\;:\"',<>?# ";
if name.contains(|c| INVALID_CHARS.contains(c)) { if name.contains(|c| INVALID_CHARS.contains(c)) {
log::error!("SharedObject::get_local: Invalid character in name"); tracing::error!("SharedObject::get_local: Invalid character in name");
return Ok(Value::Null); return Ok(Value::Null);
} }
@ -238,7 +238,7 @@ pub fn get_local<'gc>(
if let Ok(url) = url::Url::parse(url) { if let Ok(url) = url::Url::parse(url) {
url url
} else { } else {
log::error!("SharedObject::get_local: Unable to parse movie URL"); tracing::error!("SharedObject::get_local: Unable to parse movie URL");
return Ok(Value::Null); return Ok(Value::Null);
} }
} else { } else {
@ -255,7 +255,7 @@ pub fn get_local<'gc>(
// Secure parameter disallows using the shared object from non-HTTPS. // Secure parameter disallows using the shared object from non-HTTPS.
if secure && movie_url.scheme() != "https" { if secure && movie_url.scheme() != "https" {
log::warn!( tracing::warn!(
"SharedObject.get_local: Tried to load a secure shared object from non-HTTPS origin" "SharedObject.get_local: Tried to load a secure shared object from non-HTTPS origin"
); );
return Ok(Value::Null); return Ok(Value::Null);
@ -311,7 +311,7 @@ pub fn get_local<'gc>(
{ {
local_path local_path
} else { } else {
log::warn!("SharedObject.get_local: localPath parameter does not match SWF path"); tracing::warn!("SharedObject.get_local: localPath parameter does not match SWF path");
return Ok(Value::Null); return Ok(Value::Null);
} }
} else { } else {
@ -327,7 +327,7 @@ pub fn get_local<'gc>(
// Flash will generally fail to save shared objects with a path component starting with `.`, // Flash will generally fail to save shared objects with a path component starting with `.`,
// so let's disallow them altogether. // so let's disallow them altogether.
if full_name.split('/').any(|s| s.starts_with('.')) { if full_name.split('/').any(|s| s.starts_with('.')) {
log::error!("SharedObject.get_local: Invalid path with .. segments"); tracing::error!("SharedObject.get_local: Invalid path with .. segments");
return Ok(Value::Null); return Ok(Value::Null);
} }

View File

@ -49,7 +49,7 @@ pub fn constructor<'gc>(
if let Some(sound) = this.as_sound_object() { if let Some(sound) = this.as_sound_object() {
sound.set_owner(activation.context.gc_context, owner); sound.set_owner(activation.context.gc_context, owner);
} else { } else {
log::error!("Tried to construct a Sound on a non-SoundObject"); tracing::error!("Tried to construct a Sound on a non-SoundObject");
} }
Ok(this.into()) Ok(this.into())

View File

@ -618,7 +618,7 @@ pub fn set_type<'gc>(
} else if value.eq_ignore_case(WStr::from_units(b"dynamic")) { } else if value.eq_ignore_case(WStr::from_units(b"dynamic")) {
this.set_editable(false, &mut activation.context) this.set_editable(false, &mut activation.context)
} else { } else {
log::warn!("Invalid TextField.type: {}", value); tracing::warn!("Invalid TextField.type: {}", value);
} }
Ok(()) Ok(())

View File

@ -305,7 +305,7 @@ impl<'gc> Avm1<'gc> {
pub fn halt(&mut self) { pub fn halt(&mut self) {
if !self.halted { if !self.halted {
self.halted = true; self.halted = true;
log::error!("No more actions will be executed in this movie.") tracing::error!("No more actions will be executed in this movie.")
} }
} }
@ -321,7 +321,7 @@ impl<'gc> Avm1<'gc> {
#[allow(clippy::let_and_return)] #[allow(clippy::let_and_return)]
pub fn pop(&mut self) -> Value<'gc> { pub fn pop(&mut self) -> Value<'gc> {
let value = self.stack.pop().unwrap_or_else(|| { let value = self.stack.pop().unwrap_or_else(|| {
log::warn!("Avm1::pop: Stack underflow"); tracing::warn!("Avm1::pop: Stack underflow");
Value::Undefined Value::Undefined
}); });
@ -495,7 +495,7 @@ impl<'gc> Avm1<'gc> {
pub fn skip_actions(reader: &mut Reader<'_>, num_actions_to_skip: u8) { pub fn skip_actions(reader: &mut Reader<'_>, num_actions_to_skip: u8) {
for _ in 0..num_actions_to_skip { for _ in 0..num_actions_to_skip {
if let Err(e) = reader.read_action() { if let Err(e) = reader.read_action() {
log::warn!("Couldn't skip action: {}", e); tracing::warn!("Couldn't skip action: {}", e);
} }
} }
} }
@ -511,10 +511,10 @@ pub fn root_error_handler<'gc>(activation: &mut Activation<'_, 'gc, '_>, error:
return; return;
} }
Error::InvalidSwf(swf_error) => { Error::InvalidSwf(swf_error) => {
log::error!("{}: {}", error, swf_error); tracing::error!("{}: {}", error, swf_error);
} }
_ => { _ => {
log::error!("{}", error); tracing::error!("{}", error);
} }
} }
activation.context.avm1.halt(); activation.context.avm1.halt();

View File

@ -16,7 +16,7 @@ use swf::{DoAbc, DoAbcFlag};
macro_rules! avm_debug { macro_rules! avm_debug {
($avm: expr, $($arg:tt)*) => ( ($avm: expr, $($arg:tt)*) => (
if $avm.show_debug_output() { if $avm.show_debug_output() {
log::debug!($($arg)*) tracing::debug!($($arg)*)
} }
) )
} }
@ -348,7 +348,7 @@ impl<'gc> Avm2<'gc> {
/// Push a value onto the operand stack. /// Push a value onto the operand stack.
fn push(&mut self, value: impl Into<Value<'gc>>, depth: usize, max: usize) { fn push(&mut self, value: impl Into<Value<'gc>>, depth: usize, max: usize) {
if self.stack.len() - depth > max { if self.stack.len() - depth > max {
log::warn!("Avm2::push: Stack overflow"); tracing::warn!("Avm2::push: Stack overflow");
return; return;
} }
let mut value = value.into(); let mut value = value.into();
@ -366,7 +366,7 @@ impl<'gc> Avm2<'gc> {
#[allow(clippy::let_and_return)] #[allow(clippy::let_and_return)]
fn pop(&mut self, depth: usize) -> Value<'gc> { fn pop(&mut self, depth: usize) -> Value<'gc> {
let value = if self.stack.len() <= depth { let value = if self.stack.len() <= depth {
log::warn!("Avm2::pop: Stack underflow"); tracing::warn!("Avm2::pop: Stack underflow");
Value::Undefined Value::Undefined
} else { } else {
self.stack.pop().unwrap_or(Value::Undefined) self.stack.pop().unwrap_or(Value::Undefined)
@ -385,7 +385,7 @@ impl<'gc> Avm2<'gc> {
.get(self.stack.len() - index - 1) .get(self.stack.len() - index - 1)
.copied() .copied()
.unwrap_or_else(|| { .unwrap_or_else(|| {
log::warn!("Avm1::pop: Stack underflow"); tracing::warn!("Avm1::pop: Stack underflow");
Value::Undefined Value::Undefined
}); });
@ -404,7 +404,7 @@ impl<'gc> Avm2<'gc> {
fn push_scope(&mut self, scope: Scope<'gc>, depth: usize, max: usize) { fn push_scope(&mut self, scope: Scope<'gc>, depth: usize, max: usize) {
if self.scope_stack.len() - depth > max { if self.scope_stack.len() - depth > max {
log::warn!("Avm2::push_scope: Scope Stack overflow"); tracing::warn!("Avm2::push_scope: Scope Stack overflow");
return; return;
} }
@ -413,7 +413,7 @@ impl<'gc> Avm2<'gc> {
fn pop_scope(&mut self, depth: usize) -> Option<Scope<'gc>> { fn pop_scope(&mut self, depth: usize) -> Option<Scope<'gc>> {
if self.scope_stack.len() <= depth { if self.scope_stack.len() <= depth {
log::warn!("Avm2::pop_scope: Scope Stack underflow"); tracing::warn!("Avm2::pop_scope: Scope Stack underflow");
None None
} else { } else {
self.scope_stack.pop() self.scope_stack.pop()

View File

@ -931,9 +931,9 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
} }
} }
log::error!("AVM2 error: {:?}", error); tracing::error!("AVM2 error: {:?}", error);
if let Some(err) = error.as_object().and_then(|obj| obj.as_error_object()) { if let Some(err) = error.as_object().and_then(|obj| obj.as_error_object()) {
log::error!("{}", err.display_full(self)?); tracing::error!("{}", err.display_full(self)?);
} }
Err(Error::AvmError(error)) Err(Error::AvmError(error))
} }
@ -1151,7 +1151,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
} }
result result
} else if let Err(e) = op { } else if let Err(e) = op {
log::error!("Parse error: {:?}", e); tracing::error!("Parse error: {:?}", e);
Err(Error::RustError(Box::new(e))) Err(Error::RustError(Box::new(e)))
} else { } else {
unreachable!(); unreachable!();
@ -1159,7 +1159,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
} }
fn unknown_op(&mut self, op: swf::avm2::types::Op) -> Result<FrameControl<'gc>, Error<'gc>> { fn unknown_op(&mut self, op: swf::avm2::types::Op) -> Result<FrameControl<'gc>, Error<'gc>> {
log::error!("Unknown AVM2 opcode: {:?}", op); tracing::error!("Unknown AVM2 opcode: {:?}", op);
Err("Unknown op".into()) Err("Unknown op".into())
} }

View File

@ -78,7 +78,7 @@ pub fn serialize_value<'gc>(
}), }),
)) ))
} else { } else {
log::warn!( tracing::warn!(
"Serialization is not implemented for class other than Object: {:?}", "Serialization is not implemented for class other than Object: {:?}",
o o
); );
@ -161,7 +161,7 @@ pub fn deserialize_value<'gc>(
AmfValue::Object(elements, class) => { AmfValue::Object(elements, class) => {
if let Some(class) = class { if let Some(class) = class {
if !class.name.is_empty() && class.name != "Object" { if !class.name.is_empty() && class.name != "Object" {
log::warn!("Deserializing class {:?} is not supported!", class); tracing::warn!("Deserializing class {:?} is not supported!", class);
} }
} }
@ -207,7 +207,7 @@ pub fn deserialize_value<'gc>(
| AmfValue::VectorObject(..) | AmfValue::VectorObject(..)
| AmfValue::Dictionary(..) | AmfValue::Dictionary(..)
| AmfValue::Custom(..) => { | AmfValue::Custom(..) => {
log::error!("Deserialization not yet implemented: {:?}", val); tracing::error!("Deserialization not yet implemented: {:?}", val);
Value::Undefined Value::Undefined
} }
AmfValue::AMF3(val) => deserialize_value(activation, val)?, AmfValue::AMF3(val) => deserialize_value(activation, val)?,

View File

@ -205,7 +205,7 @@ impl ByteArrayStorage {
}; };
if let Some(error) = error { if let Some(error) = error {
// On error, just return an empty buffer. // On error, just return an empty buffer.
log::warn!("ByteArray.compress: {}", error); tracing::warn!("ByteArray.compress: {}", error);
buffer.clear(); buffer.clear();
} }
buffer buffer
@ -231,7 +231,7 @@ impl ByteArrayStorage {
CompressionAlgorithm::Lzma => Some("Ruffle was not compiled with LZMA support".into()), CompressionAlgorithm::Lzma => Some("Ruffle was not compiled with LZMA support".into()),
}; };
if let Some(error) = error { if let Some(error) = error {
log::warn!("ByteArray.decompress: {}", error); tracing::warn!("ByteArray.decompress: {}", error);
None None
} else { } else {
Some(buffer) Some(buffer)

View File

@ -419,7 +419,7 @@ pub fn dispatch_event_to_target<'gc>(
let object = activation.global_scope(); let object = activation.global_scope();
if let Err(err) = handler.call(object, &[event.into()], activation) { if let Err(err) = handler.call(object, &[event.into()], activation) {
log::error!( tracing::error!(
"Error dispatching event {:?} to handler {:?} : {:?}", "Error dispatching event {:?} to handler {:?} : {:?}",
event, event,
handler, handler,

View File

@ -82,7 +82,7 @@ pub fn instance_init<'gc>(
if character.is_some() { if character.is_some() {
//TODO: Determine if mismatched symbols will still work as a //TODO: Determine if mismatched symbols will still work as a
//regular BitmapData subclass, or if this should throw //regular BitmapData subclass, or if this should throw
log::warn!( tracing::warn!(
"BitmapData subclass {:?} is associated with a non-bitmap symbol", "BitmapData subclass {:?} is associated with a non-bitmap symbol",
name name
); );
@ -693,7 +693,7 @@ pub fn lock<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("BitmapData.lock - not yet implemented"); tracing::warn!("BitmapData.lock - not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -730,13 +730,13 @@ pub fn draw<'gc>(
if let Ok(mode) = BlendMode::from_str(&mode.coerce_to_string(activation)?.to_string()) { if let Ok(mode) = BlendMode::from_str(&mode.coerce_to_string(activation)?.to_string()) {
blend_mode = mode; blend_mode = mode;
} else { } else {
log::error!("Unknown blend mode {:?}", mode); tracing::error!("Unknown blend mode {:?}", mode);
return Err("ArgumentError: Error #2008: Parameter blendMode must be one of the accepted values.".into()); return Err("ArgumentError: Error #2008: Parameter blendMode must be one of the accepted values.".into());
} }
} }
if args.get(4).is_some() { if args.get(4).is_some() {
log::warn!("BitmapData.draw with clip rect - not implemented") tracing::warn!("BitmapData.draw with clip rect - not implemented")
} }
let mut bitmap_data = bitmap_data.write(activation.context.gc_context); let mut bitmap_data = bitmap_data.write(activation.context.gc_context);
@ -849,7 +849,7 @@ pub fn apply_filter<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("BitmapData.applyFilter: Not yet implemented"); tracing::warn!("BitmapData.applyFilter: Not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -818,7 +818,7 @@ pub fn set_blend_mode<'gc>(
if let Ok(mode) = BlendMode::from_str(&mode.to_string()) { if let Ok(mode) = BlendMode::from_str(&mode.to_string()) {
dobj.set_blend_mode(activation.context.gc_context, mode); dobj.set_blend_mode(activation.context.gc_context, mode);
} else { } else {
log::error!("Unknown blend mode {}", mode); tracing::error!("Unknown blend mode {}", mode);
return Err("ArgumentError: Error #2008: Parameter blendMode must be one of the accepted values.".into()); return Err("ArgumentError: Error #2008: Parameter blendMode must be one of the accepted values.".into());
} }
} }

View File

@ -170,7 +170,7 @@ pub fn get_child_by_name<'gc>(
if let Some(child) = dobj.child_by_name(&name, false) { if let Some(child) = dobj.child_by_name(&name, false) {
return Ok(child.object2()); return Ok(child.object2());
} else { } else {
log::warn!("Display object container has no child with name {}", name); tracing::warn!("Display object container has no child with name {}", name);
return Ok(Value::Null); return Ok(Value::Null);
} }
} }
@ -581,7 +581,7 @@ pub fn mouse_children<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("DisplayObjectContainer.mouseChildren getter: not yet implemented"); tracing::warn!("DisplayObjectContainer.mouseChildren getter: not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -590,7 +590,7 @@ pub fn set_mouse_children<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("DisplayObjectContainer.mouseChildren setter: not yet implemented"); tracing::warn!("DisplayObjectContainer.mouseChildren setter: not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -600,7 +600,7 @@ pub fn tab_children<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("DisplayObjectContainer.tabChildren is a stub"); tracing::warn!("DisplayObjectContainer.tabChildren is a stub");
Ok(true.into()) Ok(true.into())
} }

View File

@ -86,7 +86,7 @@ fn begin_bitmap_fill<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Graphics.beginBitmapFill: not yet implemented"); tracing::warn!("Graphics.beginBitmapFill: not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -96,7 +96,7 @@ fn begin_gradient_fill<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Graphics.beginGradientFill: not yet implemented"); tracing::warn!("Graphics.beginGradientFill: not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -162,7 +162,7 @@ pub fn tab_enabled<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("InteractiveObject.tabEnabled is a stub"); tracing::warn!("InteractiveObject.tabEnabled is a stub");
Ok(false.into()) Ok(false.into())
} }
@ -173,7 +173,7 @@ pub fn tab_index<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("InteractiveObject.tabIndex is a stub"); tracing::warn!("InteractiveObject.tabIndex is a stub");
Ok((-1).into()) Ok((-1).into())
} }
@ -187,7 +187,7 @@ pub fn focus_rect<'gc>(
// let's only warn on true, as games sometimes just set focusRect to false for some reason. // let's only warn on true, as games sometimes just set focusRect to false for some reason.
if matches!(args.get(0), Some(Value::Bool(true))) { if matches!(args.get(0), Some(Value::Bool(true))) {
log::warn!("InteractiveObject.focusRect is a stub"); tracing::warn!("InteractiveObject.focusRect is a stub");
} }
Ok(Value::Null) Ok(Value::Null)

View File

@ -268,7 +268,7 @@ pub fn parent_allows_child<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("LoaderInfo.parentAllowsChild is a stub"); tracing::warn!("LoaderInfo.parentAllowsChild is a stub");
Ok(false.into()) Ok(false.into())
} }

View File

@ -53,7 +53,7 @@ pub fn add_frame_script<'gc>(
mc.register_frame_script(frame_id, callable, &mut activation.context); mc.register_frame_script(frame_id, callable, &mut activation.context);
} }
} else { } else {
log::error!("Attempted to add frame scripts to non-MovieClip this!"); tracing::error!("Attempted to add frame scripts to non-MovieClip this!");
} }
Ok(Value::Undefined) Ok(Value::Undefined)

View File

@ -206,7 +206,7 @@ pub fn set_culling<'gc>(
} else if &*culling == b"front_and_back" { } else if &*culling == b"front_and_back" {
Context3DTriangleFace::FrontAndBack Context3DTriangleFace::FrontAndBack
} else { } else {
log::error!("Unknown culling {:?}", culling); tracing::error!("Unknown culling {:?}", culling);
Context3DTriangleFace::None Context3DTriangleFace::None
}; };

View File

@ -15,7 +15,7 @@ pub fn upload_from_byte_array<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("IndexBuffer3D.uploadFromByteArray - not yet implemented"); tracing::warn!("IndexBuffer3D.uploadFromByteArray - not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -128,7 +128,7 @@ pub fn get_concatenated_color_transform<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Transform.concatenatedColorTransform: not yet implemented"); tracing::warn!("Transform.concatenatedColorTransform: not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -43,7 +43,7 @@ pub fn instance_init<'gc>(
{ {
this.set_sound(activation.context.gc_context, *sound); this.set_sound(activation.context.gc_context, *sound);
} else { } else {
log::warn!("Attempted to construct subclass of Sound, {}, which is associated with non-Sound character {}", class_object.inner_class_definition().read().name().local_name(), symbol); tracing::warn!("Attempted to construct subclass of Sound, {}, which is associated with non-Sound character {}", class_object.inner_class_definition().read().name().local_name(), symbol);
} }
} }
} }

View File

@ -8,7 +8,7 @@ pub fn get_dynamic_property_writer<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("ObjectEncoding.dynamicPropertyWriter: Not yet implemented"); tracing::warn!("ObjectEncoding.dynamicPropertyWriter: Not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -17,6 +17,6 @@ pub fn set_dynamic_property_writer<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("ObjectEncoding.dynamicPropertyWriter: Not yet implemented"); tracing::warn!("ObjectEncoding.dynamicPropertyWriter: Not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -25,14 +25,14 @@ pub fn get_local<'gc>(
const INVALID_CHARS: &str = "~%&\\;:\"',<>?# "; const INVALID_CHARS: &str = "~%&\\;:\"',<>?# ";
if name.contains(|c| INVALID_CHARS.contains(c)) { if name.contains(|c| INVALID_CHARS.contains(c)) {
log::error!("SharedObject::get_local: Invalid character in name"); tracing::error!("SharedObject::get_local: Invalid character in name");
return Ok(Value::Null); return Ok(Value::Null);
} }
let movie = if let DisplayObject::MovieClip(movie) = activation.context.stage.root_clip() { let movie = if let DisplayObject::MovieClip(movie) = activation.context.stage.root_clip() {
movie movie
} else { } else {
log::error!("SharedObject::get_local: Movie was None"); tracing::error!("SharedObject::get_local: Movie was None");
return Ok(Value::Null); return Ok(Value::Null);
}; };
@ -40,7 +40,7 @@ pub fn get_local<'gc>(
if let Ok(url) = url::Url::parse(&url) { if let Ok(url) = url::Url::parse(&url) {
url url
} else { } else {
log::error!("SharedObject::get_local: Unable to parse movie URL"); tracing::error!("SharedObject::get_local: Unable to parse movie URL");
return Ok(Value::Null); return Ok(Value::Null);
} }
} else { } else {
@ -54,7 +54,7 @@ pub fn get_local<'gc>(
// Secure parameter disallows using the shared object from non-HTTPS. // Secure parameter disallows using the shared object from non-HTTPS.
if secure && movie_url.scheme() != "https" { if secure && movie_url.scheme() != "https" {
log::warn!( tracing::warn!(
"SharedObject.get_local: Tried to load a secure shared object from non-HTTPS origin" "SharedObject.get_local: Tried to load a secure shared object from non-HTTPS origin"
); );
return Ok(Value::Null); return Ok(Value::Null);
@ -110,7 +110,7 @@ pub fn get_local<'gc>(
{ {
local_path local_path
} else { } else {
log::warn!("SharedObject.get_local: localPath parameter does not match SWF path"); tracing::warn!("SharedObject.get_local: localPath parameter does not match SWF path");
return Ok(Value::Null); return Ok(Value::Null);
} }
} else { } else {
@ -126,7 +126,7 @@ pub fn get_local<'gc>(
// Flash will generally fail to save shared objects with a path component starting with `.`, // Flash will generally fail to save shared objects with a path component starting with `.`,
// so let's disallow them altogether. // so let's disallow them altogether.
if full_name.split('/').any(|s| s.starts_with('.')) { if full_name.split('/').any(|s| s.starts_with('.')) {
log::error!("SharedObject.get_local: Invalid path with .. segments"); tracing::error!("SharedObject.get_local: Invalid path with .. segments");
return Ok(Value::Null); return Ok(Value::Null);
} }
@ -215,7 +215,7 @@ pub fn close<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("SharedObject.close - not yet implemented"); tracing::warn!("SharedObject.close - not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -224,6 +224,6 @@ pub fn clear<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("SharedObject.clear - not yet implemented"); tracing::warn!("SharedObject.clear - not yet implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -55,7 +55,7 @@ fn spawn_fetch<'gc>(
.coerce_to_string(activation)?; .coerce_to_string(activation)?;
let method = NavigationMethod::from_method_str(&method_str).unwrap_or_else(|| { let method = NavigationMethod::from_method_str(&method_str).unwrap_or_else(|| {
log::error!("Unknown HTTP method type {:?}", method_str); tracing::error!("Unknown HTTP method type {:?}", method_str);
NavigationMethod::Get NavigationMethod::Get
}); });

View File

@ -20,7 +20,7 @@ pub fn allow_domain<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Security.allowDomain not implemented"); tracing::warn!("Security.allowDomain not implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -29,7 +29,7 @@ pub fn allow_insecure_domain<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Security.allowInsecureDomain not implemented"); tracing::warn!("Security.allowInsecureDomain not implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -38,7 +38,7 @@ pub fn load_policy_file<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Security.loadPolicyFile not implemented"); tracing::warn!("Security.loadPolicyFile not implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }
@ -47,6 +47,6 @@ pub fn show_settings<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Security.showSettings not implemented"); tracing::warn!("Security.showSettings not implemented");
Ok(Value::Undefined) Ok(Value::Undefined)
} }

View File

@ -10,7 +10,7 @@ pub fn get_caps_lock<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Keyboard.capsLock: not yet implemented"); tracing::warn!("Keyboard.capsLock: not yet implemented");
Ok(false.into()) Ok(false.into())
} }
@ -19,7 +19,7 @@ pub fn get_has_virtual_keyboard<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Keyboard.hasVirtualKeyboard: not yet implemented"); tracing::warn!("Keyboard.hasVirtualKeyboard: not yet implemented");
Ok(false.into()) Ok(false.into())
} }
@ -28,7 +28,7 @@ pub fn get_num_lock<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Keyboard.numLock: not yet implemented"); tracing::warn!("Keyboard.numLock: not yet implemented");
Ok(false.into()) Ok(false.into())
} }
@ -37,7 +37,7 @@ pub fn get_physical_keyboard_type<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Keyboard.physicalKeyboardType: not yet implemented"); tracing::warn!("Keyboard.physicalKeyboardType: not yet implemented");
Ok(AvmString::new_utf8(activation.context.gc_context, "alphanumeric").into()) Ok(AvmString::new_utf8(activation.context.gc_context, "alphanumeric").into())
} }
@ -46,6 +46,6 @@ pub fn is_accessible<'gc>(
_this: Option<Object<'gc>>, _this: Option<Object<'gc>>,
_args: &[Value<'gc>], _args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
log::warn!("Keyboard.isAccessible: not yet implemented"); tracing::warn!("Keyboard.isAccessible: not yet implemented");
Ok(true.into()) Ok(true.into())
} }

View File

@ -36,10 +36,10 @@ pub fn log_warn<'gc>(
args: &[Value<'gc>], args: &[Value<'gc>],
) -> Result<Value<'gc>, Error<'gc>> { ) -> Result<Value<'gc>, Error<'gc>> {
match args { match args {
[] => log::warn!("(__ruffle__.log_warn called with no arg)"), [] => tracing::warn!("(__ruffle__.log_warn called with no arg)"),
[arg] => { [arg] => {
let msg = arg.coerce_to_string(activation)?; let msg = arg.coerce_to_string(activation)?;
log::warn!("{}", &msg.to_utf8_lossy()); tracing::warn!("{}", &msg.to_utf8_lossy());
} }
args => { args => {
let strings = args let strings = args
@ -47,7 +47,7 @@ pub fn log_warn<'gc>(
.map(|a| a.coerce_to_string(activation)) .map(|a| a.coerce_to_string(activation))
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
let msg = crate::string::join(&strings, &WStr::from_units(b" ")); let msg = crate::string::join(&strings, &WStr::from_units(b" "));
log::warn!("{}", &msg.to_utf8_lossy()); tracing::warn!("{}", &msg.to_utf8_lossy());
} }
} }

View File

@ -219,7 +219,7 @@ impl<'gc> LoaderInfoObject<'gc> {
let init_evt = EventObject::bare_default_event(context, "init"); let init_evt = EventObject::bare_default_event(context, "init");
if let Err(e) = Avm2::dispatch_event(context, init_evt, (*self).into()) { if let Err(e) = Avm2::dispatch_event(context, init_evt, (*self).into()) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `init` event: {}", "Encountered AVM2 error when broadcasting `init` event: {}",
e e
); );
@ -242,7 +242,7 @@ impl<'gc> LoaderInfoObject<'gc> {
let complete_evt = EventObject::bare_default_event(context, "complete"); let complete_evt = EventObject::bare_default_event(context, "complete");
if let Err(e) = Avm2::dispatch_event(context, complete_evt, (*self).into()) { if let Err(e) = Avm2::dispatch_event(context, complete_evt, (*self).into()) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `complete` event: {}", "Encountered AVM2 error when broadcasting `complete` event: {}",
e e
); );

View File

@ -50,7 +50,7 @@ pub fn make_decoder<R: 'static + Read + Send + Sync>(
let decoder: Box<dyn Decoder> = match format.compression { let decoder: Box<dyn Decoder> = match format.compression {
AudioCompression::UncompressedUnknownEndian => { AudioCompression::UncompressedUnknownEndian => {
// Cross fingers that it's little endian. // Cross fingers that it's little endian.
log::warn!("make_decoder: PCM sound is unknown endian; assuming little endian"); tracing::warn!("make_decoder: PCM sound is unknown endian; assuming little endian");
Box::new(PcmDecoder::new( Box::new(PcmDecoder::new(
data, data,
format.is_stereo, format.is_stereo,

View File

@ -287,7 +287,7 @@ impl AudioMixer {
let decoder: Box<dyn SeekableDecoder> = match format.compression { let decoder: Box<dyn SeekableDecoder> = match format.compression {
AudioCompression::UncompressedUnknownEndian => { AudioCompression::UncompressedUnknownEndian => {
// Cross fingers that it's little endian. // Cross fingers that it's little endian.
log::warn!("make_decoder: PCM sound is unknown endian; assuming little endian"); tracing::warn!("make_decoder: PCM sound is unknown endian; assuming little endian");
Box::new(PcmDecoder::new( Box::new(PcmDecoder::new(
data, data,
format.is_stereo, format.is_stereo,
@ -985,7 +985,7 @@ impl dasp::signal::Signal for EnvelopeSignal {
if self.prev_point.sample > self.next_point.sample { if self.prev_point.sample > self.next_point.sample {
self.next_point.sample = self.prev_point.sample; self.next_point.sample = self.prev_point.sample;
log::error!("Invalid sound envelope; sample indices are out of order"); tracing::error!("Invalid sound envelope; sample indices are out of order");
} }
} }

View File

@ -13,7 +13,7 @@ impl NullLogBackend {
impl LogBackend for NullLogBackend { impl LogBackend for NullLogBackend {
fn avm_trace(&self, message: &str) { fn avm_trace(&self, message: &str) {
log::info!(target: "avm_trace", "{}", message); tracing::info!(target: "avm_trace", "{}", message);
} }
} }

View File

@ -193,7 +193,7 @@ impl NullSpawner {
use futures::task::LocalSpawnExt; use futures::task::LocalSpawnExt;
let _ = self.0.spawn_local(async move { let _ = self.0.spawn_local(async move {
if let Err(e) = future.await { if let Err(e) = future.await {
log::error!("Asynchronous error occurred: {}", e); tracing::error!("Asynchronous error occurred: {}", e);
} }
}); });
} }
@ -223,7 +223,7 @@ impl NullSpawner {
pub fn spawn_local(&self, future: OwnedFuture<(), Error>) { pub fn spawn_local(&self, future: OwnedFuture<(), Error>) {
wasm_bindgen_futures::spawn_local(async move { wasm_bindgen_futures::spawn_local(async move {
if let Err(e) = future.await { if let Err(e) = future.await {
log::error!("Asynchronous error occurred: {}", e); tracing::error!("Asynchronous error occurred: {}", e);
} }
}); });
} }

View File

@ -268,7 +268,7 @@ impl<'gc> BitmapData<'gc> {
); );
let bitmap_handle = renderer.register_bitmap(bitmap); let bitmap_handle = renderer.register_bitmap(bitmap);
if let Err(e) = &bitmap_handle { if let Err(e) = &bitmap_handle {
log::warn!("Failed to register raw bitmap for BitmapData: {:?}", e); tracing::warn!("Failed to register raw bitmap for BitmapData: {:?}", e);
} }
self.bitmap_handle = bitmap_handle.ok(); self.bitmap_handle = bitmap_handle.ok();
} }
@ -947,7 +947,7 @@ impl<'gc> BitmapData<'gc> {
self.height(), self.height(),
self.pixels_rgba(), self.pixels_rgba(),
) { ) {
log::error!("Failed to update dirty bitmap {:?}: {:?}", handle, e); tracing::error!("Failed to update dirty bitmap {:?}: {:?}", handle, e);
} }
self.set_dirty(false); self.set_dirty(false);
} }
@ -1087,7 +1087,7 @@ impl<'gc> BitmapData<'gc> {
match image { match image {
Ok(image) => copy_pixels_to_bitmapdata(self, image.data()), Ok(image) => copy_pixels_to_bitmapdata(self, image.data()),
Err(ruffle_render::error::Error::Unimplemented) => { Err(ruffle_render::error::Error::Unimplemented) => {
log::warn!("BitmapData.draw: Not yet implemented") tracing::warn!("BitmapData.draw: Not yet implemented")
} }
Err(e) => panic!("BitmapData.draw failed: {e:?}"), Err(e) => panic!("BitmapData.draw failed: {e:?}"),
} }

View File

@ -1316,7 +1316,7 @@ pub trait TDisplayObject<'gc>:
let name = Avm2Multiname::public(self.name()); let name = Avm2Multiname::public(self.name());
let mut activation = Avm2Activation::from_nothing(context.reborrow()); let mut activation = Avm2Activation::from_nothing(context.reborrow());
if let Err(e) = p.init_property(&name, c.into(), &mut activation) { if let Err(e) = p.init_property(&name, c.into(), &mut activation) {
log::error!( tracing::error!(
"Got error when setting AVM2 child named \"{}\": {}", "Got error when setting AVM2 child named \"{}\": {}",
&self.name(), &self.name(),
e e
@ -1355,7 +1355,7 @@ pub trait TDisplayObject<'gc>:
let dobject_constr = context.avm2.classes().display_object; let dobject_constr = context.avm2.classes().display_object;
if let Err(e) = Avm2::broadcast_event(context, frame_constructed_evt, dobject_constr) { if let Err(e) = Avm2::broadcast_event(context, frame_constructed_evt, dobject_constr) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting frameConstructed event: {}", "Encountered AVM2 error when broadcasting frameConstructed event: {}",
e e
); );
@ -1378,7 +1378,7 @@ pub trait TDisplayObject<'gc>:
let dobject_constr = context.avm2.classes().display_object; let dobject_constr = context.avm2.classes().display_object;
if let Err(e) = Avm2::broadcast_event(context, exit_frame_evt, dobject_constr) { if let Err(e) = Avm2::broadcast_event(context, exit_frame_evt, dobject_constr) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting exitFrame event: {}", "Encountered AVM2 error when broadcasting exitFrame event: {}",
e e
); );

View File

@ -313,7 +313,7 @@ impl<'gc> TDisplayObject<'gc> for Avm1Button<'gc> {
new_children.push((child, record.depth.into())); new_children.push((child, record.depth.into()));
} }
Err(error) => { Err(error) => {
log::error!( tracing::error!(
"Button ID {}: could not instantiate child ID {}: {}", "Button ID {}: could not instantiate child ID {}: {}",
read.static_data.read().id, read.static_data.read().id,
record.id, record.id,

View File

@ -216,7 +216,7 @@ impl<'gc> Avm2Button<'gc> {
children.push((child, record.depth)); children.push((child, record.depth));
} }
Err(error) => { Err(error) => {
log::error!( tracing::error!(
"Button ID {}: could not instantiate child ID {}: {}", "Button ID {}: could not instantiate child ID {}: {}",
static_data.read().id, static_data.read().id,
record.id, record.id,
@ -483,7 +483,7 @@ impl<'gc> TDisplayObject<'gc> for Avm2Button<'gc> {
let mut activation = Avm2Activation::from_nothing(context.reborrow()); let mut activation = Avm2Activation::from_nothing(context.reborrow());
match Avm2StageObject::for_display_object(&mut activation, (*self).into(), class) { match Avm2StageObject::for_display_object(&mut activation, (*self).into(), class) {
Ok(object) => self.0.write(context.gc_context).object = Some(object.into()), Ok(object) => self.0.write(context.gc_context).object = Some(object.into()),
Err(e) => log::error!("Got {} when constructing AVM2 side of button", e), Err(e) => tracing::error!("Got {} when constructing AVM2 side of button", e),
}; };
self.on_construction_complete(context); self.on_construction_complete(context);
@ -581,7 +581,7 @@ impl<'gc> TDisplayObject<'gc> for Avm2Button<'gc> {
let result: Result<(), Avm2Error> = constr_thing(); let result: Result<(), Avm2Error> = constr_thing();
if let Err(e) = result { if let Err(e) = result {
log::error!("Got {} when constructing AVM2 side of button", e); tracing::error!("Got {} when constructing AVM2 side of button", e);
} }
} }
} }

View File

@ -202,7 +202,7 @@ impl<'gc> Bitmap<'gc> {
} else if class.has_class_in_chain(context.avm2.classes().bitmapdata) { } else if class.has_class_in_chain(context.avm2.classes().bitmapdata) {
BitmapClass::BitmapData(class) BitmapClass::BitmapData(class)
} else { } else {
return log::error!("Associated class {:?} for symbol {} must extend flash.display.Bitmap or BitmapData, does neither", class.inner_class_definition().read().name(), self.id()); return tracing::error!("Associated class {:?} for symbol {} must extend flash.display.Bitmap or BitmapData, does neither", class.inner_class_definition().read().name(), self.id());
}; };
self.0.write(context.gc_context).avm2_bitmap_class = bitmap_class; self.0.write(context.gc_context).avm2_bitmap_class = bitmap_class;
@ -268,7 +268,7 @@ impl<'gc> TDisplayObject<'gc> for Bitmap<'gc> {
Ok(object) => { Ok(object) => {
self.0.write(activation.context.gc_context).avm2_object = Some(object.into()) self.0.write(activation.context.gc_context).avm2_object = Some(object.into())
} }
Err(e) => log::error!("Got error when creating AVM2 side of bitmap: {}", e), Err(e) => tracing::error!("Got error when creating AVM2 side of bitmap: {}", e),
} }
self.on_construction_complete(context); self.on_construction_complete(context);

View File

@ -27,7 +27,7 @@ pub fn dispatch_removed_from_stage_event<'gc>(
let removed_evt = Avm2EventObject::bare_default_event(context, "removedFromStage"); let removed_evt = Avm2EventObject::bare_default_event(context, "removedFromStage");
if let Err(e) = Avm2::dispatch_event(context, removed_evt, object) { if let Err(e) = Avm2::dispatch_event(context, removed_evt, object) {
log::error!("Encountered AVM2 error when dispatching event: {}", e); tracing::error!("Encountered AVM2 error when dispatching event: {}", e);
} }
} }
@ -48,7 +48,7 @@ pub fn dispatch_removed_event<'gc>(
let removed_evt = Avm2EventObject::bare_event(context, "removed", true, false); let removed_evt = Avm2EventObject::bare_event(context, "removed", true, false);
if let Err(e) = Avm2::dispatch_event(context, removed_evt, object) { if let Err(e) = Avm2::dispatch_event(context, removed_evt, object) {
log::error!("Encountered AVM2 error when dispatching event: {}", e); tracing::error!("Encountered AVM2 error when dispatching event: {}", e);
} }
if child.is_on_stage(context) { if child.is_on_stage(context) {
@ -66,7 +66,7 @@ pub fn dispatch_added_to_stage_event_only<'gc>(
let added_evt = Avm2EventObject::bare_default_event(context, "addedToStage"); let added_evt = Avm2EventObject::bare_default_event(context, "addedToStage");
if let Err(e) = Avm2::dispatch_event(context, added_evt, object) { if let Err(e) = Avm2::dispatch_event(context, added_evt, object) {
log::error!("Encountered AVM2 error when dispatching event: {}", e); tracing::error!("Encountered AVM2 error when dispatching event: {}", e);
} }
} }
} }
@ -96,7 +96,7 @@ pub fn dispatch_added_event_only<'gc>(
let added_evt = Avm2EventObject::bare_event(context, "added", true, false); let added_evt = Avm2EventObject::bare_event(context, "added", true, false);
if let Err(e) = Avm2::dispatch_event(context, added_evt, object) { if let Err(e) = Avm2::dispatch_event(context, added_evt, object) {
log::error!("Encountered AVM2 error when dispatching event: {}", e); tracing::error!("Encountered AVM2 error when dispatching event: {}", e);
} }
} }
} }

View File

@ -1318,7 +1318,7 @@ impl<'gc> EditText<'gc> {
// This makes it so that the TextField's handlers are called before other listeners'. // This makes it so that the TextField's handlers are called before other listeners'.
listeners.set_element(activation, 0, object.into()).unwrap(); listeners.set_element(activation, 0, object.into()).unwrap();
} else { } else {
log::warn!("_listeners should be empty"); tracing::warn!("_listeners should be empty");
} }
} }
} }
@ -1384,7 +1384,7 @@ impl<'gc> EditText<'gc> {
let object: Avm2Object<'gc> = object.into(); let object: Avm2Object<'gc> = object.into();
self.0.write(activation.context.gc_context).object = Some(object.into()) self.0.write(activation.context.gc_context).object = Some(object.into())
} }
Err(e) => log::error!( Err(e) => tracing::error!(
"Got {} when constructing AVM2 side of dynamic text field", "Got {} when constructing AVM2 side of dynamic text field",
e e
), ),

View File

@ -155,7 +155,9 @@ impl<'gc> TDisplayObject<'gc> for Graphic<'gc> {
Ok(object) => { Ok(object) => {
self.0.write(activation.context.gc_context).avm2_object = Some(object.into()) self.0.write(activation.context.gc_context).avm2_object = Some(object.into())
} }
Err(e) => log::error!("Got {} when constructing AVM2 side of display object", e), Err(e) => {
tracing::error!("Got {} when constructing AVM2 side of display object", e)
}
} }
self.on_construction_complete(context); self.on_construction_complete(context);
@ -172,7 +174,7 @@ impl<'gc> TDisplayObject<'gc> for Graphic<'gc> {
{ {
self.0.write(context.gc_context).static_data = new_graphic.0.read().static_data; self.0.write(context.gc_context).static_data = new_graphic.0.read().static_data;
} else { } else {
log::warn!("PlaceObject: expected Graphic at character ID {}", id); tracing::warn!("PlaceObject: expected Graphic at character ID {}", id);
} }
} }

View File

@ -236,7 +236,7 @@ pub trait TInteractiveObject<'gc>:
); );
if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) { if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
ClipEventResult::Handled ClipEventResult::Handled
@ -251,7 +251,7 @@ pub trait TInteractiveObject<'gc>:
); );
if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) { if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
ClipEventResult::Handled ClipEventResult::Handled
@ -282,7 +282,7 @@ pub trait TInteractiveObject<'gc>:
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(&mut activation.context, avm2_event, target) Avm2::dispatch_event(&mut activation.context, avm2_event, target)
{ {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
self.raw_interactive_mut(context.gc_context).last_click = None; self.raw_interactive_mut(context.gc_context).last_click = None;
@ -298,7 +298,7 @@ pub trait TInteractiveObject<'gc>:
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(&mut activation.context, avm2_event, target) Avm2::dispatch_event(&mut activation.context, avm2_event, target)
{ {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
self.raw_interactive_mut(context.gc_context).last_click = Some(this_click); self.raw_interactive_mut(context.gc_context).last_click = Some(this_click);
@ -316,7 +316,7 @@ pub trait TInteractiveObject<'gc>:
); );
if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) { if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
self.raw_interactive_mut(context.gc_context).last_click = None; self.raw_interactive_mut(context.gc_context).last_click = None;
@ -333,7 +333,7 @@ pub trait TInteractiveObject<'gc>:
); );
if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) { if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
let lca = lowest_common_ancestor( let lca = lowest_common_ancestor(
@ -355,7 +355,11 @@ pub trait TInteractiveObject<'gc>:
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(&mut activation.context, avm2_event, avm2_target) Avm2::dispatch_event(&mut activation.context, avm2_event, avm2_target)
{ {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!(
"Got error when dispatching {:?} to AVM2: {}",
event,
e
);
} }
} }
@ -386,7 +390,11 @@ pub trait TInteractiveObject<'gc>:
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(&mut activation.context, avm2_event, avm2_target) Avm2::dispatch_event(&mut activation.context, avm2_event, avm2_target)
{ {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!(
"Got error when dispatching {:?} to AVM2: {}",
event,
e
);
} }
} }
@ -402,7 +410,7 @@ pub trait TInteractiveObject<'gc>:
); );
if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) { if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
ClipEventResult::Handled ClipEventResult::Handled
@ -417,7 +425,7 @@ pub trait TInteractiveObject<'gc>:
); );
if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) { if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
ClipEventResult::Handled ClipEventResult::Handled
@ -432,7 +440,7 @@ pub trait TInteractiveObject<'gc>:
); );
if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) { if let Err(e) = Avm2::dispatch_event(&mut activation.context, avm2_event, target) {
log::error!("Got error when dispatching {:?} to AVM2: {}", event, e); tracing::error!("Got error when dispatching {:?} to AVM2: {}", event, e);
} }
ClipEventResult::Handled ClipEventResult::Handled

View File

@ -90,7 +90,7 @@ impl<'gc> TDisplayObject<'gc> for MorphShape<'gc> {
{ {
self.0.write(context.gc_context).static_data = new_morph_shape.0.read().static_data; self.0.write(context.gc_context).static_data = new_morph_shape.0.read().static_data;
} else { } else {
log::warn!("PlaceObject: expected morph shape at character ID {}", id); tracing::warn!("PlaceObject: expected morph shape at character ID {}", id);
} }
} }
@ -132,7 +132,7 @@ impl<'gc> TDisplayObject<'gc> for MorphShape<'gc> {
&local_matrix, &local_matrix,
); );
} else { } else {
log::warn!("Missing ratio for morph shape"); tracing::warn!("Missing ratio for morph shape");
} }
} }
@ -434,7 +434,7 @@ fn lerp_fill(start: &swf::FillStyle, end: &swf::FillStyle, a: f32, b: f32) -> sw
// If you happened to make, say, a solid color-to-radial gradient tween in the IDE, this would get baked down into // If you happened to make, say, a solid color-to-radial gradient tween in the IDE, this would get baked down into
// a radial-to-radial gradient on export. // a radial-to-radial gradient on export.
_ => { _ => {
log::warn!( tracing::warn!(
"Unexpected morph shape fill style combination: {:#?}, {:#?}", "Unexpected morph shape fill style combination: {:#?}, {:#?}",
start, start,
end end

View File

@ -412,7 +412,7 @@ impl<'gc> MovieClip<'gc> {
} }
} }
Some(unk) => { Some(unk) => {
log::error!( tracing::error!(
"Symbol {} changed to unexpected type {:?}", "Symbol {} changed to unexpected type {:?}",
cur_preload_symbol, cur_preload_symbol,
unk unk
@ -424,7 +424,7 @@ impl<'gc> MovieClip<'gc> {
.cur_preload_symbol = None; .cur_preload_symbol = None;
} }
None => { None => {
log::error!( tracing::error!(
"Symbol {} disappeared during preloading", "Symbol {} disappeared during preloading",
cur_preload_symbol cur_preload_symbol
); );
@ -671,7 +671,7 @@ impl<'gc> MovieClip<'gc> {
tag_len: usize, tag_len: usize,
) -> Result<(), Error> { ) -> Result<(), Error> {
if context.is_action_script_3() { if context.is_action_script_3() {
log::warn!("DoInitAction tag in AVM2 movie"); tracing::warn!("DoInitAction tag in AVM2 movie");
return Ok(()); return Ok(());
} }
@ -703,7 +703,7 @@ impl<'gc> MovieClip<'gc> {
reader: &mut SwfStream<'_>, reader: &mut SwfStream<'_>,
) -> Result<(), Error> { ) -> Result<(), Error> {
if !context.is_action_script_3() { if !context.is_action_script_3() {
log::warn!("DoABC tag in AVM1 movie"); tracing::warn!("DoABC tag in AVM1 movie");
return Ok(()); return Ok(());
} }
@ -713,7 +713,7 @@ impl<'gc> MovieClip<'gc> {
let domain = context.library.library_for_movie_mut(movie).avm2_domain(); let domain = context.library.library_for_movie_mut(movie).avm2_domain();
if let Err(e) = Avm2::do_abc(context, do_abc, domain) { if let Err(e) = Avm2::do_abc(context, do_abc, domain) {
log::warn!("Error loading ABC file: {}", e); tracing::warn!("Error loading ABC file: {}", e);
} }
} }
@ -791,7 +791,7 @@ impl<'gc> MovieClip<'gc> {
); );
} }
_ => { _ => {
log::warn!( tracing::warn!(
"Symbol class {} cannot be assigned to invalid character id {}", "Symbol class {} cannot be assigned to invalid character id {}",
class_name, class_name,
id id
@ -800,7 +800,7 @@ impl<'gc> MovieClip<'gc> {
} }
} }
} }
Err(e) => log::warn!( Err(e) => tracing::warn!(
"Got AVM2 error {} when attempting to assign symbol class {}", "Got AVM2 error {} when attempting to assign symbol class {}",
e, e,
class_name class_name
@ -1402,7 +1402,7 @@ impl<'gc> MovieClip<'gc> {
}; };
if let Err(e) = self.remove_object(context, &mut reader, version) { if let Err(e) = self.remove_object(context, &mut reader, version) {
log::error!("Error running queued tag: {:?}, got {}", tag.tag_type, e); tracing::error!("Error running queued tag: {:?}, got {}", tag.tag_type, e);
} }
} }
@ -1502,7 +1502,7 @@ impl<'gc> MovieClip<'gc> {
Some(child) Some(child)
} }
Err(e) => { Err(e) => {
log::error!( tracing::error!(
"Unable to instantiate display node id {}, reason being: {}", "Unable to instantiate display node id {}, reason being: {}",
id, id,
e e
@ -1583,7 +1583,7 @@ impl<'gc> MovieClip<'gc> {
is_implicit: bool, is_implicit: bool,
) { ) {
if cfg!(feature = "timeline_debug") { if cfg!(feature = "timeline_debug") {
log::debug!( tracing::debug!(
"[{}]: {} from frame {} to frame {}", "[{}]: {} from frame {} to frame {}",
self.name(), self.name(),
if is_implicit { "looping" } else { "goto" }, if is_implicit { "looping" } else { "goto" },
@ -1787,7 +1787,7 @@ impl<'gc> MovieClip<'gc> {
} }
} }
_ => { _ => {
log::error!( tracing::error!(
"Unexpected PlaceObject during goto: {:?}", "Unexpected PlaceObject during goto: {:?}",
params.place_object params.place_object
) )
@ -2000,7 +2000,7 @@ impl<'gc> MovieClip<'gc> {
if let Ok(object) = result { if let Ok(object) = result {
self.0.write(context.gc_context).object = Some(object.into()); self.0.write(context.gc_context).object = Some(object.into());
} else if let Err(e) = result { } else if let Err(e) = result {
log::error!("Got {} when allocating AVM2 side of display object", e); tracing::error!("Got {} when allocating AVM2 side of display object", e);
} }
} }
@ -2026,7 +2026,7 @@ impl<'gc> MovieClip<'gc> {
let result: Result<(), Avm2Error> = constr_thing(); let result: Result<(), Avm2Error> = constr_thing();
if let Err(e) = result { if let Err(e) = result {
log::error!( tracing::error!(
"Got {} when constructing AVM2 side of movie clip of type {}", "Got {} when constructing AVM2 side of movie clip of type {}",
e, e,
class_object class_object
@ -2264,7 +2264,7 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
}; };
if let Err(e) = self.place_object(context, &mut reader, version) { if let Err(e) = self.place_object(context, &mut reader, version) {
log::error!("Error running queued tag: {:?}, got {}", tag.tag_type, e); tracing::error!("Error running queued tag: {:?}, got {}", tag.tag_type, e);
} }
} }
} }
@ -2358,7 +2358,7 @@ impl<'gc> TDisplayObject<'gc> for MovieClip<'gc> {
&[], &[],
context, context,
) { ) {
log::error!( tracing::error!(
"Error occured when running AVM2 frame script: {}", "Error occured when running AVM2 frame script: {}",
e e
); );
@ -3044,13 +3044,13 @@ impl<'gc, 'a> MovieClipData<'gc> {
edit_text.set_render_settings(context.gc_context, settings.into()); edit_text.set_render_settings(context.gc_context, settings.into());
} }
Some(_) => { Some(_) => {
log::warn!( tracing::warn!(
"Tried to apply CSMTextSettings to non-text character ID {}", "Tried to apply CSMTextSettings to non-text character ID {}",
settings.id settings.id
); );
} }
None => { None => {
log::warn!( tracing::warn!(
"Tried to apply CSMTextSettings to unregistered character ID {}", "Tried to apply CSMTextSettings to unregistered character ID {}",
settings.id settings.id
); );
@ -3223,13 +3223,13 @@ impl<'gc, 'a> MovieClipData<'gc> {
button.set_colors(context.gc_context, &button_colors.color_transforms[..]); button.set_colors(context.gc_context, &button_colors.color_transforms[..]);
} }
Some(_) => { Some(_) => {
log::warn!( tracing::warn!(
"DefineButtonCxform: Tried to apply on non-button ID {}", "DefineButtonCxform: Tried to apply on non-button ID {}",
button_colors.id button_colors.id
); );
} }
None => { None => {
log::warn!( tracing::warn!(
"DefineButtonCxform: Character ID {} doesn't exist", "DefineButtonCxform: Character ID {} doesn't exist",
button_colors.id button_colors.id
); );
@ -3254,13 +3254,13 @@ impl<'gc, 'a> MovieClipData<'gc> {
button.set_sounds(context.gc_context, button_sounds); button.set_sounds(context.gc_context, button_sounds);
} }
Some(_) => { Some(_) => {
log::warn!( tracing::warn!(
"DefineButtonSound: Tried to apply on non-button ID {}", "DefineButtonSound: Tried to apply on non-button ID {}",
button_sounds.id button_sounds.id
); );
} }
None => { None => {
log::warn!( tracing::warn!(
"DefineButtonSound: Character ID {} doesn't exist", "DefineButtonSound: Character ID {} doesn't exist",
button_sounds.id button_sounds.id
); );
@ -3375,7 +3375,7 @@ impl<'gc, 'a> MovieClipData<'gc> {
_context: &mut UpdateContext<'_, 'gc, '_>, _context: &mut UpdateContext<'_, 'gc, '_>,
_reader: &mut SwfStream<'a>, _reader: &mut SwfStream<'a>,
) -> Result<(), Error> { ) -> Result<(), Error> {
log::warn!("DefineFont4 tag (TLF text) is not implemented"); tracing::warn!("DefineFont4 tag (TLF text) is not implemented");
Ok(()) Ok(())
} }
@ -3392,7 +3392,7 @@ impl<'gc, 'a> MovieClipData<'gc> {
.library_for_movie_mut(self.movie()) .library_for_movie_mut(self.movie())
.register_character(sound.id, Character::Sound(handle)); .register_character(sound.id, Character::Sound(handle));
} else { } else {
log::error!( tracing::error!(
"MovieClip::define_sound: Unable to register sound ID {}", "MovieClip::define_sound: Unable to register sound ID {}",
sound.id sound.id
); );
@ -3557,7 +3557,7 @@ impl<'gc, 'a> MovieClipData<'gc> {
{ {
v.insert(cur_frame); v.insert(cur_frame);
} else { } else {
log::warn!("Movie clip {}: Duplicated frame label", self.id()); tracing::warn!("Movie clip {}: Duplicated frame label", self.id());
} }
Ok(()) Ok(())
} }
@ -3624,7 +3624,7 @@ impl<'gc, 'a> MovieClip<'gc> {
tag_len: usize, tag_len: usize,
) -> Result<(), Error> { ) -> Result<(), Error> {
if context.is_action_script_3() { if context.is_action_script_3() {
log::warn!("DoAction tag in AVM2 movie"); tracing::warn!("DoAction tag in AVM2 movie");
return Ok(()); return Ok(());
} }

View File

@ -618,7 +618,7 @@ impl<'gc> Stage<'gc> {
} else if let Avm2Value::Object(stage) = self.object2() { } else if let Avm2Value::Object(stage) = self.object2() {
let resized_event = Avm2EventObject::bare_default_event(context, "resize"); let resized_event = Avm2EventObject::bare_default_event(context, "resize");
if let Err(e) = crate::avm2::Avm2::dispatch_event(context, resized_event, stage) { if let Err(e) = crate::avm2::Avm2::dispatch_event(context, resized_event, stage) {
log::error!("Encountered AVM2 error when dispatching event: {}", e); tracing::error!("Encountered AVM2 error when dispatching event: {}", e);
} }
} }
} }
@ -650,7 +650,7 @@ impl<'gc> Stage<'gc> {
.unwrap(); // we don't expect to break here .unwrap(); // we don't expect to break here
if let Err(e) = crate::avm2::Avm2::dispatch_event(context, full_screen_event, stage) { if let Err(e) = crate::avm2::Avm2::dispatch_event(context, full_screen_event, stage) {
log::error!("Encountered AVM2 error when dispatching event: {}", e); tracing::error!("Encountered AVM2 error when dispatching event: {}", e);
} }
} }
} }
@ -711,7 +711,7 @@ impl<'gc> TDisplayObject<'gc> for Stage<'gc> {
write.avm2_object = avm2_stage.into(); write.avm2_object = avm2_stage.into();
write.stage3ds = vec![stage3d]; write.stage3ds = vec![stage3d];
} }
Err(e) => log::error!("Unable to construct AVM2 Stage: {}", e), Err(e) => tracing::error!("Unable to construct AVM2 Stage: {}", e),
} }
} }
@ -766,7 +766,7 @@ impl<'gc> TDisplayObject<'gc> for Stage<'gc> {
let dobject_constr = context.avm2.classes().display_object; let dobject_constr = context.avm2.classes().display_object;
if let Err(e) = Avm2::broadcast_event(context, enter_frame_evt, dobject_constr) { if let Err(e) = Avm2::broadcast_event(context, enter_frame_evt, dobject_constr) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting enterFrame event: {}", "Encountered AVM2 error when broadcasting enterFrame event: {}",
e e
); );

View File

@ -103,7 +103,7 @@ impl<'gc> TDisplayObject<'gc> for Text<'gc> {
{ {
self.0.write(context.gc_context).static_data = new_text.0.read().static_data; self.0.write(context.gc_context).static_data = new_text.0.read().static_data;
} else { } else {
log::warn!("PlaceObject: expected text at character ID {}", id); tracing::warn!("PlaceObject: expected text at character ID {}", id);
} }
} }
@ -254,7 +254,7 @@ impl<'gc> TDisplayObject<'gc> for Text<'gc> {
Ok(object) => { Ok(object) => {
self.0.write(activation.context.gc_context).avm2_object = Some(object.into()) self.0.write(activation.context.gc_context).avm2_object = Some(object.into())
} }
Err(e) => log::error!("Got error when creating AVM2 side of Text: {}", e), Err(e) => tracing::error!("Got error when creating AVM2 side of Text: {}", e),
} }
self.on_construction_complete(context); self.on_construction_complete(context);

View File

@ -152,7 +152,7 @@ impl<'gc> Video<'gc> {
let subslice = SwfSlice::from(movie.clone()).to_unbounded_subslice(tag.data); let subslice = SwfSlice::from(movie.clone()).to_unbounded_subslice(tag.data);
if frames.contains_key(&tag.frame_num.into()) { if frames.contains_key(&tag.frame_num.into()) {
log::warn!("Duplicate frame {}", tag.frame_num); tracing::warn!("Duplicate frame {}", tag.frame_num);
} }
frames.insert(tag.frame_num.into(), (subslice.start, subslice.end)); frames.insert(tag.frame_num.into(), (subslice.start, subslice.end));
@ -245,7 +245,7 @@ impl<'gc> Video<'gc> {
let stream = if let VideoStream::Instantiated(stream) = &read.stream { let stream = if let VideoStream::Instantiated(stream) = &read.stream {
stream stream
} else { } else {
log::error!("Attempted to seek uninstantiated video stream."); tracing::error!("Attempted to seek uninstantiated video stream.");
return; return;
}; };
@ -281,7 +281,7 @@ impl<'gc> Video<'gc> {
Ok(bitmap) => { Ok(bitmap) => {
self.0.write(context.gc_context).decoded_frame = Some((frame_id, bitmap)); self.0.write(context.gc_context).decoded_frame = Some((frame_id, bitmap));
} }
Err(e) => log::error!("Got error when seeking to video frame {}: {}", frame_id, e), Err(e) => tracing::error!("Got error when seeking to video frame {}: {}", frame_id, e),
} }
} }
} }
@ -335,7 +335,7 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
streamdef.deblocking, streamdef.deblocking,
); );
if stream.is_err() { if stream.is_err() {
log::error!( tracing::error!(
"Got error when post-instantiating video: {}", "Got error when post-instantiating video: {}",
stream.unwrap_err() stream.unwrap_err()
); );
@ -361,7 +361,7 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
} }
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
log::error!("Got error when pre-loading video frame: {}", e); tracing::error!("Got error when pre-loading video frame: {}", e);
} }
} }
} }
@ -373,7 +373,7 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
let starting_seek = if let VideoStream::Uninstantiated(seek_to) = write.stream { let starting_seek = if let VideoStream::Uninstantiated(seek_to) = write.stream {
seek_to seek_to
} else { } else {
log::warn!("Reinstantiating already-instantiated video stream!"); tracing::warn!("Reinstantiating already-instantiated video stream!");
0 0
}; };
@ -413,7 +413,7 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
let object: Avm2Object<'gc> = object.into(); let object: Avm2Object<'gc> = object.into();
self.0.write(context.gc_context).object = Some(object.into()) self.0.write(context.gc_context).object = Some(object.into())
} }
Err(e) => log::error!("Got {} when constructing AVM2 side of video player", e), Err(e) => tracing::error!("Got {} when constructing AVM2 side of video player", e),
} }
self.on_construction_complete(context); self.on_construction_complete(context);
@ -480,7 +480,7 @@ impl<'gc> TDisplayObject<'gc> for Video<'gc> {
.commands .commands
.render_bitmap(&bitmap.handle, &transform, smoothing); .render_bitmap(&bitmap.handle, &transform, smoothing);
} else { } else {
log::warn!("Video has no decoded frame to render."); tracing::warn!("Video has no decoded frame to render.");
} }
context.transform_stack.pop(); context.transform_stack.pop();

View File

@ -204,7 +204,7 @@ impl Value {
.collect(); .collect();
Value::List(values) Value::List(values)
} else { } else {
log::warn!("from_avm2 needs to be implemented for Avm2Value::Object"); tracing::warn!("from_avm2 needs to be implemented for Avm2Value::Object");
Value::Null Value::Null
} }
} }
@ -220,7 +220,7 @@ impl Value {
Avm2Value::String(AvmString::new_utf8(activation.context.gc_context, value)) Avm2Value::String(AvmString::new_utf8(activation.context.gc_context, value))
} }
Value::Object(_values) => { Value::Object(_values) => {
log::warn!("into_avm2 needs to be implemented for Value::Object"); tracing::warn!("into_avm2 needs to be implemented for Value::Object");
Avm2Value::Undefined Avm2Value::Undefined
} }
Value::List(values) => { Value::List(values) => {

View File

@ -42,7 +42,7 @@ impl<'gc> FocusTracker<'gc> {
new.on_focus_changed(context.gc_context, true); new.on_focus_changed(context.gc_context, true);
} }
log::info!("Focus is now on {:?}", focused_element); tracing::info!("Focus is now on {:?}", focused_element);
let level0 = context.stage.root_clip(); let level0 = context.stage.root_clip();
Avm1::notify_system_listeners( Avm1::notify_system_listeners(

View File

@ -618,7 +618,7 @@ impl FormatSpans {
let attributes = match attributes { let attributes = match attributes {
Ok(attributes) => attributes, Ok(attributes) => attributes,
Err(e) => { Err(e) => {
log::warn!("Error while parsing HTML: {}", e); tracing::warn!("Error while parsing HTML: {}", e);
return Default::default(); return Default::default();
} }
}; };
@ -799,7 +799,7 @@ impl FormatSpans {
} }
Ok(Event::Eof) => break, Ok(Event::Eof) => break,
Err(e) => { Err(e) => {
log::warn!("Error while parsing HTML: {}", e); tracing::warn!("Error while parsing HTML: {}", e);
break; break;
} }
_ => {} _ => {}

View File

@ -126,7 +126,7 @@ impl<'gc> MovieLibrary<'gc> {
self.characters.insert(id, character); self.characters.insert(id, character);
} else { } else {
log::error!("Character ID collision: Tried to register ID {} twice", id); tracing::error!("Character ID collision: Tried to register ID {} twice", id);
} }
} }
@ -142,7 +142,7 @@ impl<'gc> MovieLibrary<'gc> {
.insert(export_name, character.clone(), false); .insert(export_name, character.clone(), false);
Some(character) Some(character)
} else { } else {
log::warn!( tracing::warn!(
"Can't register export {}: Character ID {} doesn't exist", "Can't register export {}: Character ID {} doesn't exist",
export_name, export_name,
id, id,
@ -173,7 +173,7 @@ impl<'gc> MovieLibrary<'gc> {
if let Some(character) = self.characters.get(&id) { if let Some(character) = self.characters.get(&id) {
self.instantiate_display_object(character, gc_context) self.instantiate_display_object(character, gc_context)
} else { } else {
log::error!("Tried to instantiate non-registered character ID {}", id); tracing::error!("Tried to instantiate non-registered character ID {}", id);
Err("Character id doesn't exist") Err("Character id doesn't exist")
} }
} }
@ -188,7 +188,7 @@ impl<'gc> MovieLibrary<'gc> {
if let Some(character) = self.export_characters.get(export_name, false) { if let Some(character) = self.export_characters.get(export_name, false) {
self.instantiate_display_object(character, gc_context) self.instantiate_display_object(character, gc_context)
} else { } else {
log::error!( tracing::error!(
"Tried to instantiate non-registered character {}", "Tried to instantiate non-registered character {}",
export_name export_name
); );
@ -290,7 +290,7 @@ impl<'gc> MovieLibrary<'gc> {
if self.jpeg_tables.is_some() { if self.jpeg_tables.is_some() {
// SWF spec says there should only be one JPEGTables tag. // SWF spec says there should only be one JPEGTables tag.
// TODO: What is the behavior when there are multiples? // TODO: What is the behavior when there are multiples?
log::warn!("SWF contains multiple JPEGTables tags"); tracing::warn!("SWF contains multiple JPEGTables tags");
return; return;
} }
// Some SWFs have a JPEGTables tag with 0 length; ignore these. // Some SWFs have a JPEGTables tag with 0 length; ignore these.

View File

@ -439,7 +439,7 @@ impl<'gc> LoadManager<'gc> {
if matches!(status, Some(LoaderStatus::Parsing)) { if matches!(status, Some(LoaderStatus::Parsing)) {
match Loader::preload_tick(handle, context, limit) { match Loader::preload_tick(handle, context, limit) {
Ok(f) => did_finish = did_finish && f, Ok(f) => did_finish = did_finish && f,
Err(e) => log::error!("Error encountered while preloading movie: {}", e), Err(e) => tracing::error!("Error encountered while preloading movie: {}", e),
} }
} }
} }
@ -602,7 +602,7 @@ impl<'gc> Loader<'gc> {
if target_clip.as_movie_clip().is_none() { if target_clip.as_movie_clip().is_none() {
// Non-movie-clip loads should not be handled in preload_tick // Non-movie-clip loads should not be handled in preload_tick
log::error!("Cannot preload non-movie-clip loader"); tracing::error!("Cannot preload non-movie-clip loader");
return Ok(false); return Ok(false);
} }
@ -783,7 +783,7 @@ impl<'gc> Loader<'gc> {
)?; )?;
} }
Err(e) => { Err(e) => {
log::error!("Error during movie loading: {:?}", e); tracing::error!("Error during movie loading: {:?}", e);
player.lock().unwrap().update(|uc| -> Result<(), Error> { player.lock().unwrap().update(|uc| -> Result<(), Error> {
Loader::movie_loader_error(handle, uc) Loader::movie_loader_error(handle, uc)
})?; })?;
@ -1046,7 +1046,7 @@ impl<'gc> Loader<'gc> {
&body, &body,
)), )),
DataFormat::Variables => { DataFormat::Variables => {
log::warn!( tracing::warn!(
"Support for URLLoaderDataFormat.VARIABLES not yet implemented" "Support for URLLoaderDataFormat.VARIABLES not yet implemented"
); );
Avm2Value::Undefined Avm2Value::Undefined
@ -1075,7 +1075,7 @@ impl<'gc> Loader<'gc> {
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(&mut activation.context, open_evt, target) Avm2::dispatch_event(&mut activation.context, open_evt, target)
{ {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `open` event: {}", "Encountered AVM2 error when broadcasting `open` event: {}",
e e
); );
@ -1089,7 +1089,7 @@ impl<'gc> Loader<'gc> {
); );
if let Err(e) = Avm2::dispatch_event(uc, complete_evt, target) { if let Err(e) = Avm2::dispatch_event(uc, complete_evt, target) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `complete` event: {}", "Encountered AVM2 error when broadcasting `complete` event: {}",
e e
); );
@ -1118,7 +1118,7 @@ impl<'gc> Loader<'gc> {
.map_err(|e| Error::Avm2Error(e.to_string()))?; .map_err(|e| Error::Avm2Error(e.to_string()))?;
if let Err(e) = Avm2::dispatch_event(uc, io_error_evt, target) { if let Err(e) = Avm2::dispatch_event(uc, io_error_evt, target) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `ioError` event: {}", "Encountered AVM2 error when broadcasting `ioError` event: {}",
e e
); );
@ -1235,7 +1235,7 @@ impl<'gc> Loader<'gc> {
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(&mut activation.context, open_evt, sound_object) Avm2::dispatch_event(&mut activation.context, open_evt, sound_object)
{ {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `open` event: {}", "Encountered AVM2 error when broadcasting `open` event: {}",
e e
); );
@ -1246,7 +1246,7 @@ impl<'gc> Loader<'gc> {
"complete", "complete",
); );
if let Err(e) = Avm2::dispatch_event(uc, complete_evt, sound_object) { if let Err(e) = Avm2::dispatch_event(uc, complete_evt, sound_object) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `complete` event: {}", "Encountered AVM2 error when broadcasting `complete` event: {}",
e e
); );
@ -1270,7 +1270,7 @@ impl<'gc> Loader<'gc> {
.map_err(|e| Error::Avm2Error(e.to_string()))?; .map_err(|e| Error::Avm2Error(e.to_string()))?;
if let Err(e) = Avm2::dispatch_event(uc, io_error_evt, sound_object) { if let Err(e) = Avm2::dispatch_event(uc, io_error_evt, sound_object) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `ioError` event: {}", "Encountered AVM2 error when broadcasting `ioError` event: {}",
e e
); );
@ -1316,7 +1316,7 @@ impl<'gc> Loader<'gc> {
let open_evt = Avm2EventObject::bare_default_event(&mut activation.context, "open"); let open_evt = Avm2EventObject::bare_default_event(&mut activation.context, "open");
if let Err(e) = Avm2::dispatch_event(uc, open_evt, loader_info) { if let Err(e) = Avm2::dispatch_event(uc, open_evt, loader_info) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `open` event: {}", "Encountered AVM2 error when broadcasting `open` event: {}",
e e
); );
@ -1527,7 +1527,7 @@ impl<'gc> Loader<'gc> {
.map_err(|e| Error::Avm2Error(e.to_string()))?; .map_err(|e| Error::Avm2Error(e.to_string()))?;
if let Err(e) = Avm2::dispatch_event(uc, progress_evt, loader_info) { if let Err(e) = Avm2::dispatch_event(uc, progress_evt, loader_info) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `progress` event: {}", "Encountered AVM2 error when broadcasting `progress` event: {}",
e e
); );
@ -1640,7 +1640,7 @@ impl<'gc> Loader<'gc> {
.map_err(|e| Error::Avm2Error(e.to_string()))?; .map_err(|e| Error::Avm2Error(e.to_string()))?;
if let Err(e) = Avm2::dispatch_event(uc, io_error_evt, loader_info) { if let Err(e) = Avm2::dispatch_event(uc, io_error_evt, loader_info) {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `ioError` event: {}", "Encountered AVM2 error when broadcasting `ioError` event: {}",
e e
); );

View File

@ -42,7 +42,6 @@ use crate::timer::Timers;
use crate::vminterface::Instantiator; use crate::vminterface::Instantiator;
use gc_arena::{make_arena, ArenaParameters, Collect, GcCell}; use gc_arena::{make_arena, ArenaParameters, Collect, GcCell};
use instant::Instant; use instant::Instant;
use log::info;
use rand::{rngs::SmallRng, SeedableRng}; use rand::{rngs::SmallRng, SeedableRng};
use ruffle_render::backend::{null::NullRenderer, RenderBackend, ViewportDimensions}; use ruffle_render::backend::{null::NullRenderer, RenderBackend, ViewportDimensions};
use ruffle_render::commands::CommandList; use ruffle_render::commands::CommandList;
@ -55,6 +54,7 @@ use std::rc::{Rc, Weak as RcWeak};
use std::str::FromStr; use std::str::FromStr;
use std::sync::{Arc, Mutex, Weak}; use std::sync::{Arc, Mutex, Weak};
use std::time::Duration; use std::time::Duration;
use tracing::info;
/// The newest known Flash Player version, serves as a default to /// The newest known Flash Player version, serves as a default to
/// `player_version`. /// `player_version`.
@ -585,7 +585,7 @@ impl Player {
crate::avm1::make_context_menu_state(menu_object, &mut activation) crate::avm1::make_context_menu_state(menu_object, &mut activation)
} else if let Avm2Value::Object(_obj) = root_dobj.object2() { } else if let Avm2Value::Object(_obj) = root_dobj.object2() {
// TODO: send "menuSelect" event // TODO: send "menuSelect" event
log::warn!("AVM2 Context menu callbacks are not implemented"); tracing::warn!("AVM2 Context menu callbacks are not implemented");
let mut activation = Avm2Activation::from_nothing(context.reborrow()); let mut activation = Avm2Activation::from_nothing(context.reborrow());
@ -858,7 +858,7 @@ impl Player {
&mut activation, &mut activation,
); );
} }
log::info!("Variable dump:\n{}", dumper.output()); tracing::info!("Variable dump:\n{}", dumper.output());
}); });
} }
PlayerEvent::KeyDown { PlayerEvent::KeyDown {
@ -869,13 +869,15 @@ impl Player {
{ {
self.mutate_with_update_context(|context| { self.mutate_with_update_context(|context| {
if context.avm1.show_debug_output() { if context.avm1.show_debug_output() {
log::info!( tracing::info!(
"AVM Debugging turned off! Press CTRL+ALT+D to turn on again." "AVM Debugging turned off! Press CTRL+ALT+D to turn on again."
); );
context.avm1.set_show_debug_output(false); context.avm1.set_show_debug_output(false);
context.avm2.set_show_debug_output(false); context.avm2.set_show_debug_output(false);
} else { } else {
log::info!("AVM Debugging turned on! Press CTRL+ALT+D to turn off."); tracing::info!(
"AVM Debugging turned on! Press CTRL+ALT+D to turn off."
);
context.avm1.set_show_debug_output(true); context.avm1.set_show_debug_output(true);
context.avm2.set_show_debug_output(true); context.avm2.set_show_debug_output(true);
} }
@ -997,7 +999,7 @@ impl Player {
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(&mut activation.context, keyboard_event, target) Avm2::dispatch_event(&mut activation.context, keyboard_event, target)
{ {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `{}` event: {}", "Encountered AVM2 error when broadcasting `{}` event: {}",
event_name, event_name,
e e
@ -1405,7 +1407,7 @@ impl Player {
); );
match progress_evt { match progress_evt {
Err(e) => log::error!( Err(e) => tracing::error!(
"Encountered AVM2 error when broadcasting `progress` event: {}", "Encountered AVM2 error when broadcasting `progress` event: {}",
e e
), ),
@ -1413,7 +1415,7 @@ impl Player {
if let Err(e) = if let Err(e) =
Avm2::dispatch_event(context, progress_evt, loader_info) Avm2::dispatch_event(context, progress_evt, loader_info)
{ {
log::error!( tracing::error!(
"Encountered AVM2 error when broadcasting `progress` event: {}", "Encountered AVM2 error when broadcasting `progress` event: {}",
e e
); );
@ -1646,14 +1648,14 @@ impl Player {
if let Err(e) = if let Err(e) =
Avm2::run_stack_frame_for_callable(callable, reciever, &args[..], context) Avm2::run_stack_frame_for_callable(callable, reciever, &args[..], context)
{ {
log::error!("Unhandled AVM2 exception in event handler: {}", e); tracing::error!("Unhandled AVM2 exception in event handler: {}", e);
} }
} }
ActionType::Event2 { event_type, target } => { ActionType::Event2 { event_type, target } => {
let event = Avm2EventObject::bare_default_event(context, event_type); let event = Avm2EventObject::bare_default_event(context, event_type);
if let Err(e) = Avm2::dispatch_event(context, event, target) { if let Err(e) = Avm2::dispatch_event(context, event, target) {
log::error!("Unhandled AVM2 exception in event handler: {}", e); tracing::error!("Unhandled AVM2 exception in event handler: {}", e);
} }
} }
} }
@ -1815,7 +1817,7 @@ impl Player {
Activation::from_stub(context.reborrow(), ActivationIdentifier::root("[Flush]")); Activation::from_stub(context.reborrow(), ActivationIdentifier::root("[Flush]"));
for so in avm1_activation.context.avm1_shared_objects.clone().values() { for so in avm1_activation.context.avm1_shared_objects.clone().values() {
if let Err(e) = crate::avm1::flush(&mut avm1_activation, *so, &[]) { if let Err(e) = crate::avm1::flush(&mut avm1_activation, *so, &[]) {
log::error!("Error flushing AVM1 shared object `{:?}`: {:?}", so, e); tracing::error!("Error flushing AVM1 shared object `{:?}`: {:?}", so, e);
} }
} }
@ -1827,7 +1829,7 @@ impl Player {
Some(*so), Some(*so),
&[], &[],
) { ) {
log::error!("Error flushing AVM2 shared object `{:?}`: {:?}", so, e); tracing::error!("Error flushing AVM2 shared object `{:?}`: {:?}", so, e);
} }
} }
}); });

View File

@ -2,12 +2,12 @@ pub use crate::avm2::Value as Avm2Value;
pub use crate::display_object::{ pub use crate::display_object::{
DisplayObject, DisplayObjectContainer, HitTestOptions, TDisplayObject, TDisplayObjectContainer, DisplayObject, DisplayObjectContainer, HitTestOptions, TDisplayObject, TDisplayObjectContainer,
}; };
pub use log::{error, info, trace, warn};
pub use ruffle_render::bounding_box::BoundingBox; pub use ruffle_render::bounding_box::BoundingBox;
pub use ruffle_render::color_transform::ColorTransform; pub use ruffle_render::color_transform::ColorTransform;
pub use ruffle_render::matrix::Matrix; pub use ruffle_render::matrix::Matrix;
pub use std::ops::{Bound, RangeBounds}; pub use std::ops::{Bound, RangeBounds};
pub use swf::{CharacterId, Color, Twips}; pub use swf::{CharacterId, Color, Twips};
pub use tracing::{error, info, trace, warn};
/// A depth for a Flash display object in AVM1. /// A depth for a Flash display object in AVM1.
/// This is different than defined in `swf`; during execution, clips /// This is different than defined in `swf`; during execution, clips

View File

@ -385,7 +385,7 @@ where
loop { loop {
let (tag_code, tag_len) = reader.read_tag_code_and_length()?; let (tag_code, tag_len) = reader.read_tag_code_and_length()?;
if tag_len > reader.get_ref().len() { if tag_len > reader.get_ref().len() {
log::error!("Unexpected EOF when reading tag"); tracing::error!("Unexpected EOF when reading tag");
*reader.get_mut() = &reader.get_ref()[reader.get_ref().len()..]; *reader.get_mut() = &reader.get_ref()[reader.get_ref().len()..];
return Ok(false); return Ok(false);
} }
@ -398,7 +398,7 @@ where
match result { match result {
Err(e) => { Err(e) => {
log::error!("Error running definition tag: {:?}, got {}", tag, e) tracing::error!("Error running definition tag: {:?}, got {}", tag, e)
} }
Ok(ControlFlow::Exit) => { Ok(ControlFlow::Exit) => {
*reader.get_mut() = end_slice; *reader.get_mut() = end_slice;
@ -407,7 +407,7 @@ where
Ok(ControlFlow::Continue) => {} Ok(ControlFlow::Continue) => {}
} }
} else { } else {
log::warn!("Unknown tag code: {:?}", tag_code); tracing::warn!("Unknown tag code: {:?}", tag_code);
} }
*reader.get_mut() = end_slice; *reader.get_mut() = end_slice;

View File

@ -92,7 +92,7 @@ impl<'gc> Timers<'gc> {
); );
if let Err(e) = result { if let Err(e) = result {
log::error!("Unhandled AVM1 error in timer callback: {}", e); tracing::error!("Unhandled AVM1 error in timer callback: {}", e);
} }
false false
@ -110,7 +110,7 @@ impl<'gc> Timers<'gc> {
); );
if let Err(e) = result { if let Err(e) = result {
log::error!("Unhandled AVM1 error in timer callback: {}", e); tracing::error!("Unhandled AVM1 error in timer callback: {}", e);
} }
false false
@ -121,7 +121,7 @@ impl<'gc> Timers<'gc> {
match closure.call(None, &params, &mut avm2_activation) { match closure.call(None, &params, &mut avm2_activation) {
Ok(v) => v.coerce_to_boolean(), Ok(v) => v.coerce_to_boolean(),
Err(e) => { Err(e) => {
log::error!("Unhandled AVM2 error in timer callback: {}", e); tracing::error!("Unhandled AVM2 error in timer callback: {}", e);
false false
} }
} }