void sc_report_handler::default_handler(const sc_report& rep, const sc_actions& actions) { if ( actions & SC_DISPLAY ) ::std::cout << ::std::endl << sc_report_compose_message(rep) << ::std::endl; if ( (actions & SC_LOG) && get_log_file_name() ) { if ( !log_stream ) log_stream = new ::std::ofstream(get_log_file_name()); // ios::trunc *log_stream << rep.get_time() << ": " << sc_report_compose_message(rep) << ::std::endl; } if ( actions & SC_STOP ) { sc_stop_here(rep.get_msg_type(), rep.get_severity()); sc_stop(); } if ( actions & SC_INTERRUPT ) sc_interrupt_here(rep.get_msg_type(), rep.get_severity()); if ( actions & SC_ABORT ) abort(); if ( actions & SC_THROW ) throw rep; }
void Logger::open_log(void) { g_assert(!h_log_file); const std::string log_filename = get_log_file_name(); h_log_file = g_fopen(log_filename.c_str(), "w"); if(!h_log_file) g_warning("Unable to create log file %s", log_filename.c_str()); }
void start_device_log(void) { int fd = unix_open(get_log_file_name().c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0640); if (fd == -1) { return; } // Redirect stdout and stderr to the log file. dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); fprintf(stderr, "--- adb starting (pid %d) ---\n", getpid()); adb_close(fd); }