From 2ea1e1821abf88c1b5ff1b42ac67fdd24dadfb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Mon, 21 Sep 2015 19:19:47 +0200 Subject: [PATCH] Rename logging function due to namespace conflict --- src/config.cc | 4 ++-- src/directories.cc | 14 +++++++------- src/juci.cc | 2 +- src/logging.h | 14 +++++++------- src/notebook.cc | 18 +++++++++--------- src/source.cc | 6 +++--- src/terminal.cc | 8 ++++---- src/terminal_win.cc | 4 ++-- src/window.cc | 4 ++-- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/config.cc b/src/config.cc index d7bcaa1..75e750c 100644 --- a/src/config.cc +++ b/src/config.cc @@ -65,7 +65,7 @@ void MainConfig::GenerateSource() { void MainConfig::GenerateDirectoryFilter() { auto dir_cfg=Singleton::Config::directories(); - DEBUG("Fetching directory filter"); + JDEBUG("Fetching directory filter"); boost::property_tree::ptree dir_json = cfg.get_child("directoryfilter"); boost::property_tree::ptree ignore_json = dir_json.get_child("ignore"); boost::property_tree::ptree except_json = dir_json.get_child("exceptions"); @@ -73,5 +73,5 @@ void MainConfig::GenerateDirectoryFilter() { dir_cfg->exceptions.emplace_back(i.second.get_value()); for ( auto &i : ignore_json ) dir_cfg->ignored.emplace_back(i.second.get_value()); - DEBUG("Directory filter fetched"); + JDEBUG("Directory filter fetched"); } diff --git a/src/directories.cc b/src/directories.cc index 5a761a4..5416936 100644 --- a/src/directories.cc +++ b/src/directories.cc @@ -23,7 +23,7 @@ namespace sigc { } Directories::Directories() : stop_update_thread(false) { - DEBUG("start"); + JDEBUG("start"); add(tree_view); set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); tree_store = Gtk::TreeStore::create(column_record); @@ -120,7 +120,7 @@ Directories::~Directories() { } void Directories::open(const boost::filesystem::path& dir_path) { - DEBUG("start"); + JDEBUG("start"); if(dir_path=="") return; @@ -142,21 +142,21 @@ void Directories::open(const boost::filesystem::path& dir_path) { current_path=dir_path; - DEBUG("end"); + JDEBUG("end"); } void Directories::update() { - DEBUG("start"); + JDEBUG("start"); update_mutex.lock(); for(auto &last_write_time: last_write_times) { add_path(last_write_time.first, last_write_time.second.first); } update_mutex.unlock(); - DEBUG("end"); + JDEBUG("end"); } void Directories::select(const boost::filesystem::path &path) { - DEBUG("start"); + JDEBUG("start"); if(current_path=="") return; @@ -196,7 +196,7 @@ void Directories::select(const boost::filesystem::path &path) { } return false; }); - DEBUG("end"); + JDEBUG("end"); } bool Directories::ignored(std::string path) { diff --git a/src/juci.cc b/src/juci.cc index c83eb47..c4164bc 100644 --- a/src/juci.cc +++ b/src/juci.cc @@ -9,7 +9,7 @@ void init_logging() { boost::log::add_common_attributes(); boost::log::add_file_log(boost::log::keywords::file_name = Singleton::log_dir() + "juci.log", boost::log::keywords::auto_flush = true); - INFO("Logging initalized"); + JINFO("Logging initalized"); } int app::on_command_line(const Glib::RefPtr &cmd) { diff --git a/src/logging.h b/src/logging.h index fbd9f89..7fd780b 100644 --- a/src/logging.h +++ b/src/logging.h @@ -15,12 +15,12 @@ #define INFO_VAR(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; #define WARNING_VAR(x) BOOST_LOG_TRIVIAL(warning) << "** Warning: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; #define FATAL_VAR(x) BOOST_LOG_TRIVIAL(fatal) << "** Fatal: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; -#define ERROR_VAR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; -#define TRACE(x) BOOST_LOG_TRIVIAL(trace) << "** Trace: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; -#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << "** Debug: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; -#define INFO(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; -#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << "** Warning: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; -#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << "** Fatal: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; -#define ERROR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; +#define JERROR_VAR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; +#define JTRACE(x) BOOST_LOG_TRIVIAL(trace) << "** Trace: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; +#define JDEBUG(x) BOOST_LOG_TRIVIAL(debug) << "** Debug: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; +#define JINFO(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; +#define JWARNING(x) BOOST_LOG_TRIVIAL(warning) << "** Warning: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; +#define JFATAL(x) BOOST_LOG_TRIVIAL(fatal) << "** Fatal: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; +#define JERROR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; #endif // JUCI_LOGGING_H_ diff --git a/src/notebook.cc b/src/notebook.cc index 40b9874..041f8c1 100644 --- a/src/notebook.cc +++ b/src/notebook.cc @@ -48,7 +48,7 @@ Source::View* Notebook::get_current_view() { } void Notebook::open(const boost::filesystem::path &file_path) { - DEBUG("start"); + JDEBUG("start"); for(int c=0;cfile_path) { set_current_page(c); @@ -124,13 +124,13 @@ void Notebook::open(const boost::filesystem::path &file_path) { set_tab_label_text(*(get_nth_page(page)), title); }); - DEBUG("end"); + JDEBUG("end"); } bool Notebook::save(int page, bool reparse_needed) { - DEBUG("start"); + JDEBUG("start"); if(page>=size()) { - DEBUG("end false"); + JDEBUG("end false"); return false; } auto view=get_view(page); @@ -166,12 +166,12 @@ bool Notebook::save(int page, bool reparse_needed) { } } } - DEBUG("end true"); + JDEBUG("end true"); return true; } Singleton::terminal()->print("Error: could not save file " +view->file_path.string()+"\n"); } - DEBUG("end false"); + JDEBUG("end false"); return false; } @@ -182,11 +182,11 @@ bool Notebook::save_current() { } bool Notebook::close_current_page() { - DEBUG("start"); + JDEBUG("start"); if (get_current_page()!=-1) { if(get_current_view()->get_buffer()->get_modified()){ if(!save_modified_dialog()) { - DEBUG("end false"); + JDEBUG("end false"); return false; } } @@ -202,7 +202,7 @@ bool Notebook::close_current_page() { scrolled_windows.erase(scrolled_windows.begin()+index); hboxes.erase(hboxes.begin()+index); } - DEBUG("end true"); + JDEBUG("end true"); return true; } diff --git a/src/source.cc b/src/source.cc index 98cb8ff..b25a30c 100644 --- a/src/source.cc +++ b/src/source.cc @@ -972,7 +972,7 @@ clang::Index Source::ClangViewParse::clang_index(0, 0); Source::ClangViewParse::ClangViewParse(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path, Glib::RefPtr language): Source::View(file_path, language), project_path(project_path), parse_error(false) { - DEBUG("start"); + JDEBUG("start"); auto scheme = get_source_buffer()->get_style_scheme(); auto tag_table=get_buffer()->get_tag_table(); for (auto &item : Singleton::Config::source()->clang_types) { @@ -991,7 +991,7 @@ Source::View(file_path, language), project_path(project_path), parse_error(false // // if (style->property_line_background_set()) tag->property_line_background() = style->property_line_background(); // // if (style->property_underline_set()) tag->property_underline() = style->property_underline(); } else - INFO("Style " + item.second + " not found in " + scheme->get_name()); + JINFO("Style " + item.second + " not found in " + scheme->get_name()); } } @@ -1039,7 +1039,7 @@ Source::View(file_path, language), project_path(project_path), parse_error(false bracket_regex=std::regex(std::string("^(")+tab_char+"*).*\\{ *$"); no_bracket_statement_regex=std::regex(std::string("^(")+tab_char+"*)(if|for|else if|catch|while) *\\(.*[^;}] *$"); no_bracket_no_para_statement_regex=std::regex(std::string("^(")+tab_char+"*)(else|try|do) *$"); - DEBUG("end"); + JDEBUG("end"); } Source::ClangViewParse::~ClangViewParse() { diff --git a/src/terminal.cc b/src/terminal.cc index eb96fcf..7cee28b 100644 --- a/src/terminal.cc +++ b/src/terminal.cc @@ -154,7 +154,7 @@ Terminal::Terminal() { } int Terminal::execute(const std::string &command, const boost::filesystem::path &path) { - DEBUG("start"); + JDEBUG("start"); int stdin_fd, stdout_fd, stderr_fd; auto pid=popen3(command, path.string(), &stdin_fd, &stdout_fd, &stderr_fd); @@ -192,14 +192,14 @@ int Terminal::execute(const std::string &command, const boost::filesystem::path close(stdout_fd); close(stderr_fd); - DEBUG("end"); + JDEBUG("end"); return exit_code; } } void Terminal::async_execute(const std::string &command, const boost::filesystem::path &path, std::function callback) { std::thread async_execute_thread([this, command, path, callback](){ - DEBUG("start"); + JDEBUG("start"); int stdin_fd, stdout_fd, stderr_fd; async_executes_mutex.lock(); stdin_buffer.clear(); @@ -254,7 +254,7 @@ void Terminal::async_execute(const std::string &command, const boost::filesystem if(callback) callback(exit_code); - DEBUG("end"); + JDEBUG("end"); } }); async_execute_thread.detach(); diff --git a/src/terminal_win.cc b/src/terminal_win.cc index e79014d..8cd9238 100644 --- a/src/terminal_win.cc +++ b/src/terminal_win.cc @@ -332,7 +332,7 @@ void Terminal::kill_async_executes(bool force) { } int Terminal::print(const std::string &message, bool bold){ - INFO("Terminal: PrintMessage"); + JINFO("Terminal: PrintMessage"); if(bold) get_buffer()->insert_with_tag(get_buffer()->end(), message, bold_tag); else @@ -349,7 +349,7 @@ int Terminal::print(const std::string &message, bool bold){ } void Terminal::print(int line_nr, const std::string &message){ - INFO("Terminal: PrintMessage at line " << line_nr); + JINFO("Terminal: PrintMessage at line " << line_nr); auto iter=get_buffer()->get_iter_at_line(line_nr); while(!iter.ends_line()) iter++; diff --git a/src/window.cc b/src/window.cc index 0daf779..8ac72a6 100644 --- a/src/window.cc +++ b/src/window.cc @@ -32,7 +32,7 @@ void Window::generate_keybindings() { } Window::Window() : box(Gtk::ORIENTATION_VERTICAL), notebook(*Singleton::directories()), compiling(false) { - DEBUG("start"); + JDEBUG("start"); set_title("juCi++"); set_default_size(600, 400); set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::SCROLL_MASK); @@ -133,7 +133,7 @@ Window::Window() : box(Gtk::ORIENTATION_VERTICAL), notebook(*Singleton::director about.set_comments("This is an open source IDE with high-end features to make your programming experience juicy"); about.set_license_type(Gtk::License::LICENSE_MIT_X11); about.set_transient_for(*this); - DEBUG("end"); + JDEBUG("end"); } // Window constructor void Window::create_menu() {