#[macro_use] the log crate (#775)

This commit is contained in:
0HyperCube
2022-09-08 21:14:01 +01:00
committed by Keavon Chambers
parent 655831eedf
commit 788552e10c
18 changed files with 49 additions and 42 deletions
@@ -40,7 +40,7 @@ impl MessageHandler<ArtboardMessage, &FontCache> for ArtboardMessageHandler {
}
}
Ok(None) => {}
Err(e) => log::error!("Artboard Error: {:?}", e),
Err(e) => error!("Artboard Error: {:?}", e),
},
// Messages
@@ -27,7 +27,6 @@ use graphene::layers::vector::subpath::Subpath;
use graphene::{DocumentError, DocumentResponse, LayerId, Operation as DocumentOperation};
use glam::{DAffine2, DVec2};
use log::warn;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
@@ -108,7 +107,7 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
DocumentResponse::LayerChanged { path } => responses.push_back(LayerChanged { affected_layer_path: path.clone() }.into()),
DocumentResponse::CreatedLayer { path } => {
if self.layer_metadata.contains_key(path) {
log::warn!("CreatedLayer overrides existing layer metadata.");
warn!("CreatedLayer overrides existing layer metadata.");
}
self.layer_metadata.insert(path.clone(), LayerMetadata::new(false));
@@ -126,7 +125,7 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
responses.push_back(BroadcastEvent::DocumentIsDirty.into());
}
}
Err(e) => log::error!("DocumentError: {:?}", e),
Err(e) => error!("DocumentError: {:?}", e),
Ok(_) => (),
},
#[remain::unsorted]
@@ -162,7 +161,7 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
// Messages
AbortTransaction => {
self.undo(responses).unwrap_or_else(|e| log::warn!("{}", e));
self.undo(responses).unwrap_or_else(|e| warn!("{}", e));
responses.extend([RenderDocument.into(), DocumentStructureChanged.into()]);
}
AddSelectedLayers { additional_layers } => {
@@ -243,7 +242,7 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
let initial_level = log::max_level();
log::set_max_level(log::LevelFilter::Trace);
log::trace!("{:#?}\n{:#?}", self.graphene_document, self.layer_metadata);
trace!("{:#?}\n{:#?}", self.graphene_document, self.layer_metadata);
log::set_max_level(initial_level);
}
@@ -291,8 +290,8 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
responses.push_front(DocumentMessage::DirtyRenderDocument.into());
}
}
DocumentHistoryBackward => self.undo(responses).unwrap_or_else(|e| log::warn!("{}", e)),
DocumentHistoryForward => self.redo(responses).unwrap_or_else(|e| log::warn!("{}", e)),
DocumentHistoryBackward => self.undo(responses).unwrap_or_else(|e| warn!("{}", e)),
DocumentHistoryForward => self.redo(responses).unwrap_or_else(|e| warn!("{}", e)),
DocumentStructureChanged => {
let data_buffer: RawBuffer = self.serialize_root().into();
responses.push_back(FrontendMessage::UpdateDocumentLayerTreeStructure { data_buffer }.into())
@@ -537,7 +536,7 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
);
}
RollbackTransaction => {
self.rollback(responses).unwrap_or_else(|e| log::warn!("{}", e));
self.rollback(responses).unwrap_or_else(|e| warn!("{}", e));
responses.extend([RenderDocument.into(), DocumentStructureChanged.into()]);
}
SaveDocument => {
@@ -867,7 +866,7 @@ impl DocumentMessageHandler {
let data = self.layer_panel_entry(path.to_vec(), font_cache).ok()?;
(!path.is_empty()).then(|| FrontendMessage::UpdateDocumentLayerDetails { data }.into())
} else {
log::warn!("Tried to select non existing layer {:?}", path);
warn!("Tried to select non existing layer {:?}", path);
None
}
}
@@ -20,7 +20,7 @@ impl MessageHandler<OverlaysMessage, (bool, &FontCache, &InputPreprocessorMessag
#[remain::unsorted]
DispatchOperation(operation) => match self.overlays_graphene_document.handle_operation(*operation, font_cache) {
Ok(_) => responses.push_back(OverlaysMessage::Rerender.into()),
Err(e) => log::error!("OverlaysError: {:?}", e),
Err(e) => error!("OverlaysError: {:?}", e),
},
// Messages
@@ -77,7 +77,7 @@ impl Platform {
match self {
Platform::Mac => KeyboardPlatformLayout::Mac,
Platform::Unknown => {
log::warn!("The platform has not been set, remember to send `GlobalsMessage::SetPlatform` during editor initialization.");
warn!("The platform has not been set, remember to send `GlobalsMessage::SetPlatform` during editor initialization.");
KeyboardPlatformLayout::Standard
}
_ => KeyboardPlatformLayout::Standard,
@@ -203,7 +203,7 @@ impl<'a> Selected<'a> {
if let Ok(layer) = document.layer(path) {
original_transforms.insert(path.to_vec(), layer.transform);
} else {
log::warn!("Didn't find a layer for {:?}", path);
warn!("Didn't find a layer for {:?}", path);
}
}
}