Browse Source

Rename logging function due to namespace conflict

merge-requests/365/head
Jørgen Lien Sellæg 10 years ago
parent
commit
2ea1e1821a
  1. 4
      src/config.cc
  2. 14
      src/directories.cc
  3. 2
      src/juci.cc
  4. 14
      src/logging.h
  5. 18
      src/notebook.cc
  6. 6
      src/source.cc
  7. 8
      src/terminal.cc
  8. 4
      src/terminal_win.cc
  9. 4
      src/window.cc

4
src/config.cc

@ -65,7 +65,7 @@ void MainConfig::GenerateSource() {
void MainConfig::GenerateDirectoryFilter() { void MainConfig::GenerateDirectoryFilter() {
auto dir_cfg=Singleton::Config::directories(); 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 dir_json = cfg.get_child("directoryfilter");
boost::property_tree::ptree ignore_json = dir_json.get_child("ignore"); boost::property_tree::ptree ignore_json = dir_json.get_child("ignore");
boost::property_tree::ptree except_json = dir_json.get_child("exceptions"); 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<std::string>()); dir_cfg->exceptions.emplace_back(i.second.get_value<std::string>());
for ( auto &i : ignore_json ) for ( auto &i : ignore_json )
dir_cfg->ignored.emplace_back(i.second.get_value<std::string>()); dir_cfg->ignored.emplace_back(i.second.get_value<std::string>());
DEBUG("Directory filter fetched"); JDEBUG("Directory filter fetched");
} }

14
src/directories.cc

@ -23,7 +23,7 @@ namespace sigc {
} }
Directories::Directories() : stop_update_thread(false) { Directories::Directories() : stop_update_thread(false) {
DEBUG("start"); JDEBUG("start");
add(tree_view); add(tree_view);
set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
tree_store = Gtk::TreeStore::create(column_record); tree_store = Gtk::TreeStore::create(column_record);
@ -120,7 +120,7 @@ Directories::~Directories() {
} }
void Directories::open(const boost::filesystem::path& dir_path) { void Directories::open(const boost::filesystem::path& dir_path) {
DEBUG("start"); JDEBUG("start");
if(dir_path=="") if(dir_path=="")
return; return;
@ -142,21 +142,21 @@ void Directories::open(const boost::filesystem::path& dir_path) {
current_path=dir_path; current_path=dir_path;
DEBUG("end"); JDEBUG("end");
} }
void Directories::update() { void Directories::update() {
DEBUG("start"); JDEBUG("start");
update_mutex.lock(); update_mutex.lock();
for(auto &last_write_time: last_write_times) { for(auto &last_write_time: last_write_times) {
add_path(last_write_time.first, last_write_time.second.first); add_path(last_write_time.first, last_write_time.second.first);
} }
update_mutex.unlock(); update_mutex.unlock();
DEBUG("end"); JDEBUG("end");
} }
void Directories::select(const boost::filesystem::path &path) { void Directories::select(const boost::filesystem::path &path) {
DEBUG("start"); JDEBUG("start");
if(current_path=="") if(current_path=="")
return; return;
@ -196,7 +196,7 @@ void Directories::select(const boost::filesystem::path &path) {
} }
return false; return false;
}); });
DEBUG("end"); JDEBUG("end");
} }
bool Directories::ignored(std::string path) { bool Directories::ignored(std::string path) {

2
src/juci.cc

@ -9,7 +9,7 @@ void init_logging() {
boost::log::add_common_attributes(); boost::log::add_common_attributes();
boost::log::add_file_log(boost::log::keywords::file_name = Singleton::log_dir() + "juci.log", boost::log::add_file_log(boost::log::keywords::file_name = Singleton::log_dir() + "juci.log",
boost::log::keywords::auto_flush = true); boost::log::keywords::auto_flush = true);
INFO("Logging initalized"); JINFO("Logging initalized");
} }
int app::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine> &cmd) { int app::on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine> &cmd) {

14
src/logging.h

@ -15,12 +15,12 @@
#define INFO_VAR(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): " << #x << "=<" << x << ">"; #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 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 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 JERROR_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 JTRACE(x) BOOST_LOG_TRIVIAL(trace) << "** Trace: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define DEBUG(x) BOOST_LOG_TRIVIAL(debug) << "** Debug: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; #define JDEBUG(x) BOOST_LOG_TRIVIAL(debug) << "** Debug: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define INFO(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; #define JINFO(x) BOOST_LOG_TRIVIAL(info) << "** Info: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define WARNING(x) BOOST_LOG_TRIVIAL(warning) << "** Warning: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; #define JWARNING(x) BOOST_LOG_TRIVIAL(warning) << "** Warning: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define FATAL(x) BOOST_LOG_TRIVIAL(fatal) << "** Fatal: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; #define JFATAL(x) BOOST_LOG_TRIVIAL(fatal) << "** Fatal: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#define ERROR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\""; #define JERROR(x) BOOST_LOG_TRIVIAL(error) << "** Error: " << __FILE__ << "@" << __func__ << "(" << __LINE__ << "): \"" << x << "\"";
#endif // JUCI_LOGGING_H_ #endif // JUCI_LOGGING_H_

18
src/notebook.cc

@ -48,7 +48,7 @@ Source::View* Notebook::get_current_view() {
} }
void Notebook::open(const boost::filesystem::path &file_path) { void Notebook::open(const boost::filesystem::path &file_path) {
DEBUG("start"); JDEBUG("start");
for(int c=0;c<size();c++) { for(int c=0;c<size();c++) {
if(file_path==get_view(c)->file_path) { if(file_path==get_view(c)->file_path) {
set_current_page(c); 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); set_tab_label_text(*(get_nth_page(page)), title);
}); });
DEBUG("end"); JDEBUG("end");
} }
bool Notebook::save(int page, bool reparse_needed) { bool Notebook::save(int page, bool reparse_needed) {
DEBUG("start"); JDEBUG("start");
if(page>=size()) { if(page>=size()) {
DEBUG("end false"); JDEBUG("end false");
return false; return false;
} }
auto view=get_view(page); 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; return true;
} }
Singleton::terminal()->print("Error: could not save file " +view->file_path.string()+"\n"); Singleton::terminal()->print("Error: could not save file " +view->file_path.string()+"\n");
} }
DEBUG("end false"); JDEBUG("end false");
return false; return false;
} }
@ -182,11 +182,11 @@ bool Notebook::save_current() {
} }
bool Notebook::close_current_page() { bool Notebook::close_current_page() {
DEBUG("start"); JDEBUG("start");
if (get_current_page()!=-1) { if (get_current_page()!=-1) {
if(get_current_view()->get_buffer()->get_modified()){ if(get_current_view()->get_buffer()->get_modified()){
if(!save_modified_dialog()) { if(!save_modified_dialog()) {
DEBUG("end false"); JDEBUG("end false");
return false; return false;
} }
} }
@ -202,7 +202,7 @@ bool Notebook::close_current_page() {
scrolled_windows.erase(scrolled_windows.begin()+index); scrolled_windows.erase(scrolled_windows.begin()+index);
hboxes.erase(hboxes.begin()+index); hboxes.erase(hboxes.begin()+index);
} }
DEBUG("end true"); JDEBUG("end true");
return true; return true;
} }

6
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<Gsv::Language> language): Source::ClangViewParse::ClangViewParse(const boost::filesystem::path &file_path, const boost::filesystem::path& project_path, Glib::RefPtr<Gsv::Language> language):
Source::View(file_path, language), project_path(project_path), parse_error(false) { 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 scheme = get_source_buffer()->get_style_scheme();
auto tag_table=get_buffer()->get_tag_table(); auto tag_table=get_buffer()->get_tag_table();
for (auto &item : Singleton::Config::source()->clang_types) { 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_line_background_set()) tag->property_line_background() = style->property_line_background();
// // if (style->property_underline_set()) tag->property_underline() = style->property_underline(); // // if (style->property_underline_set()) tag->property_underline() = style->property_underline();
} else } 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+"*).*\\{ *$"); 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_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) *$"); no_bracket_no_para_statement_regex=std::regex(std::string("^(")+tab_char+"*)(else|try|do) *$");
DEBUG("end"); JDEBUG("end");
} }
Source::ClangViewParse::~ClangViewParse() { Source::ClangViewParse::~ClangViewParse() {

8
src/terminal.cc

@ -154,7 +154,7 @@ Terminal::Terminal() {
} }
int Terminal::execute(const std::string &command, const boost::filesystem::path &path) { int Terminal::execute(const std::string &command, const boost::filesystem::path &path) {
DEBUG("start"); JDEBUG("start");
int stdin_fd, stdout_fd, stderr_fd; int stdin_fd, stdout_fd, stderr_fd;
auto pid=popen3(command, path.string(), &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(stdout_fd);
close(stderr_fd); close(stderr_fd);
DEBUG("end"); JDEBUG("end");
return exit_code; return exit_code;
} }
} }
void Terminal::async_execute(const std::string &command, const boost::filesystem::path &path, std::function<void(int exit_code)> callback) { void Terminal::async_execute(const std::string &command, const boost::filesystem::path &path, std::function<void(int exit_code)> callback) {
std::thread async_execute_thread([this, command, path, callback](){ std::thread async_execute_thread([this, command, path, callback](){
DEBUG("start"); JDEBUG("start");
int stdin_fd, stdout_fd, stderr_fd; int stdin_fd, stdout_fd, stderr_fd;
async_executes_mutex.lock(); async_executes_mutex.lock();
stdin_buffer.clear(); stdin_buffer.clear();
@ -254,7 +254,7 @@ void Terminal::async_execute(const std::string &command, const boost::filesystem
if(callback) if(callback)
callback(exit_code); callback(exit_code);
DEBUG("end"); JDEBUG("end");
} }
}); });
async_execute_thread.detach(); async_execute_thread.detach();

4
src/terminal_win.cc

@ -332,7 +332,7 @@ void Terminal::kill_async_executes(bool force) {
} }
int Terminal::print(const std::string &message, bool bold){ int Terminal::print(const std::string &message, bool bold){
INFO("Terminal: PrintMessage"); JINFO("Terminal: PrintMessage");
if(bold) if(bold)
get_buffer()->insert_with_tag(get_buffer()->end(), message, bold_tag); get_buffer()->insert_with_tag(get_buffer()->end(), message, bold_tag);
else else
@ -349,7 +349,7 @@ int Terminal::print(const std::string &message, bool bold){
} }
void Terminal::print(int line_nr, const std::string &message){ 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); auto iter=get_buffer()->get_iter_at_line(line_nr);
while(!iter.ends_line()) while(!iter.ends_line())
iter++; iter++;

4
src/window.cc

@ -32,7 +32,7 @@ void Window::generate_keybindings() {
} }
Window::Window() : box(Gtk::ORIENTATION_VERTICAL), notebook(*Singleton::directories()), compiling(false) { Window::Window() : box(Gtk::ORIENTATION_VERTICAL), notebook(*Singleton::directories()), compiling(false) {
DEBUG("start"); JDEBUG("start");
set_title("juCi++"); set_title("juCi++");
set_default_size(600, 400); set_default_size(600, 400);
set_events(Gdk::POINTER_MOTION_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::SCROLL_MASK); 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_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_license_type(Gtk::License::LICENSE_MIT_X11);
about.set_transient_for(*this); about.set_transient_for(*this);
DEBUG("end"); JDEBUG("end");
} // Window constructor } // Window constructor
void Window::create_menu() { void Window::create_menu() {

Loading…
Cancel
Save