aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/logging.rs2
-rw-r--r--src/macros.rs16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/logging.rs b/src/logging.rs
index a691778a..10929980 100644
--- a/src/logging.rs
+++ b/src/logging.rs
@@ -47,7 +47,7 @@ impl<T: Send + io::Write> log::Log for Logger<T> {
fn log(&self, record: &log::Record) {
if self.enabled(record.metadata()) && record.target().starts_with("alacritty") {
if let Ok(ref mut writer) = self.output.lock() {
- writer.write_all(format!("{}\n", record.args()).as_ref()).expect("Error while logging!");
+ let _ = writer.write_all(format!("{}\n", record.args()).as_ref());
}
}
}
diff --git a/src/macros.rs b/src/macros.rs
index 35e69f2d..464110e6 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -29,3 +29,19 @@ macro_rules! maybe {
}
}
}
+
+#[macro_export]
+macro_rules! print {
+ ($($arg:tt)*) => {{
+ use std::io::Write;
+ let _ = write!(::std::io::stdout(), $($arg)*);
+ }};
+}
+
+#[macro_export]
+macro_rules! eprint {
+ ($($arg:tt)*) => {{
+ use std::io::Write;
+ let _ = write!(::std::io::stderr(), $($arg)*);
+ }};
+}