From 839949b7fedd21cb66661e6ffb187d8b5f46a83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Tue, 12 May 2015 10:22:30 +0200 Subject: [PATCH] edit logging service --- juci/juci.cc | 3 ++- juci/logging.h | 16 ++++++---------- juci/source.cc | 8 ++++---- juci/window.cc | 3 +++ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/juci/juci.cc b/juci/juci.cc index d20260e..199d97e 100644 --- a/juci/juci.cc +++ b/juci/juci.cc @@ -7,7 +7,8 @@ int main(int argc, char *argv[]) { argv, "no.sout.juci"); - init_logging(); + add_file_log("juci.log"); + INFO("Logging initalized"); Window window; return app->run(window); } diff --git a/juci/logging.h b/juci/logging.h index c779488..f6cdc55 100644 --- a/juci/logging.h +++ b/juci/logging.h @@ -12,15 +12,11 @@ using namespace boost::log; -#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define INFO(x) BOOST_LOG_TRIVIAL(info) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; -#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">\n"; - -void init_logging() { - add_file_log("juci.log"); -} +#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define INFO(x) BOOST_LOG_TRIVIAL(info) << __func__ << "(" << __LINE__ << "): \"" x << "\""; +#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define ERROR(x) BOOST_LOG_TRIVIAL(error) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; #endif // JUCI_LOGGING_H_ diff --git a/juci/source.cc b/juci/source.cc index ea6a213..ea05e9c 100644 --- a/juci/source.cc +++ b/juci/source.cc @@ -5,9 +5,7 @@ #include #include #include "notebook.h" - -#define log( var ) \ - std::cout << "source.cc (" << __LINE__ << ") " << #var << std::endl +#include "logging.h" Source::Location:: Location(int line_number, int column_offset) : @@ -267,7 +265,9 @@ HighlightToken(clang::Token *token, // Constructor for Controller Source::Controller::Controller(const Source::Config &config, Notebook::Controller *notebook) : - model_(config), notebook_(notebook) { } + model_(config), notebook_(notebook) { + INFO("Source Controller with childs constructed"); +} // Source::Controller::view() // return shared_ptr to the view diff --git a/juci/window.cc b/juci/window.cc index 5177995..562f09b 100644 --- a/juci/window.cc +++ b/juci/window.cc @@ -1,4 +1,5 @@ #include "window.h" +#include "logging.h" Window::Window() : window_box_(Gtk::ORIENTATION_VERTICAL), @@ -6,6 +7,7 @@ Window::Window() : keybindings_(main_config_.keybindings_cfg()), notebook_(this,keybindings(), main_config_.source_cfg(), main_config_.dir_cfg()), menu_(keybindings()) { + INFO("Creating window"); set_title("juCi++"); set_default_size(600, 400); add(window_box_); @@ -83,6 +85,7 @@ Window::Window() : window_box_.pack_start(notebook_.view()); window_box_.pack_end(terminal_.view(),Gtk::PACK_SHRINK); show_all_children(); + INFO("Window created"); } // Window constructor void Window::OnWindowHide() {