diff options
author | Lukas Lueg <lukas.lueg@gmail.com> | 2017-01-13 08:15:06 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-01-23 09:14:01 -0800 |
commit | 64b42cd2f3f1da1d6a99dcdf90e6f7728ddca968 (patch) | |
tree | 4856f4884144e1cbba8a0fc8185b446193515430 /src/main.rs | |
parent | b23ed6ed4c53a6d010238643c443da6db3931a87 (diff) | |
download | alacritty-64b42cd2f3f1da1d6a99dcdf90e6f7728ddca968.tar.gz alacritty-64b42cd2f3f1da1d6a99dcdf90e6f7728ddca968.zip |
Use the log-crate instead of printing to stdout
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index cda28d13..265a9ee8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,6 +19,9 @@ #[macro_use] extern crate alacritty; +#[macro_use] +extern crate log; + use std::error::Error; use std::sync::Arc; @@ -27,12 +30,14 @@ use alacritty::config::{self, Config}; use alacritty::display::Display; use alacritty::event; use alacritty::event_loop::{self, EventLoop}; +use alacritty::logging; use alacritty::sync::FairMutex; use alacritty::term::{Term}; use alacritty::tty::{self, process_should_exit}; use alacritty::util::fmt::Red; fn main() { + // Load configuration let config = Config::load().unwrap_or_else(|err| { match err { @@ -55,12 +60,15 @@ fn main() { // Load command line options let options = cli::Options::load(); + // Initialize the logger before entering alacritty main loop + logging::initialize(&options); + // Run alacritty if let Err(err) = run(config, options) { die!("Alacritty encountered an unrecoverable error:\n\n\t{}\n", Red(err)); } - println!("Goodbye"); + info!("Goodbye."); } @@ -69,12 +77,14 @@ fn main() { /// Creates a window, the terminal state, pty, I/O event loop, input processor, /// config change monitor, and runs the main display loop. fn run(mut config: Config, options: cli::Options) -> Result<(), Box<Error>> { + info!("Welcome to Alacritty."); + // Create a display. // // The display manages a window and can draw the terminal let mut display = Display::new(&config, &options)?; - println!( + info!( "PTY Dimensions: {:?} x {:?}", display.size().lines(), display.size().cols() |