/** * Add Logging plugin to File menu */ bool LoggingPlugin::initialize(const QStringList & args, QString *errMsg) { Q_UNUSED(args); Q_UNUSED(errMsg); loggingThread = NULL; // Add Menu entry Core::ActionManager *am = Core::ICore::instance()->actionManager(); Core::ActionContainer *ac = am->actionContainer(Core::Constants::M_TOOLS); // Command to start logging cmd = am->registerAction(new QAction(this), "LoggingPlugin.Logging", QList<int>() << Core::Constants::C_GLOBAL_ID); cmd->setDefaultKeySequence(QKeySequence("Ctrl+L")); cmd->action()->setText(tr("Start logging...")); ac->menu()->addSeparator(); ac->appendGroup("Logging"); ac->addAction(cmd, "Logging"); connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(toggleLogging())); mf = new LoggingGadgetFactory(this); addAutoReleasedObject(mf); // Map signal from end of replay to replay stopped connect(getLogfile(), SIGNAL(replayFinished()), this, SLOT(replayStopped())); connect(getLogfile(), SIGNAL(replayStarted()), this, SLOT(replayStarted())); return true; }
Logger::~Logger() { resetStream(NULL); if (getLogfile().is_open()) { getLogfile().flush(); getLogfile().close(); } loglevel.reset(); }
/** * Received the replay stoppedsignal from the LogFile */ void LoggingPlugin::replayStopped() { Q_ASSERT(state == REPLAY); if(uavTalk) delete(uavTalk); getLogfile()->close(); uavTalk = 0; state = IDLE; emit stateChanged("IDLE"); }
int main( int argc, char **argv ) { #ifdef DELLOG { FILE *fh; fh=fopen(getLogfile(),"w"); fclose(fh); } #endif gtk_init(&argc, &argv); #if DEBUGLEV > 4 errormsg(MAPMSG,"\nmain: Trying to load MapPieces Pixbuf..."); #endif if (!MapPicLoad()) { printf("Could not load MapPieces Bitmap.\n"); CloseAll(); exit(20); } #if DEBUGLEV > 4 errormsg(MAPMSG,".Done\nmain: Trying to initialize window.."); #endif if (!(WO_Window=InitTestMEdWindow())) { printf("Did not get a Window pointer. Continuing anyway..\n"); //CloseAll(); //exit(20); } #if DEBUGLEV > 4 errormsg(MAPMSG,".Done\nMain Loop\n"); #endif /* Main Loop */ gtk_main(); #if DEBUGLEV > 4 errormsg(MAPMSG,"Exiting.."); #endif CloseAll(); #if DEBUGLEV > 4 errormsg(MAPMSG,".Done\n"); #endif exit(0); }
// ------------------------- // Class Logger // ------------------------- Logger::Logger(size_t level, std::string filename, bool dual) : static_loglevel(level), local_stream(), loglevel(), logfilename(filename) { bool logdual = getLogdual(); logdual = dual; getDeafstream().setstate(std::ios_base::eofbit); resetStream(new LogStream); loglevel.reset(new size_t(level)); if (!logfilename.empty()) getLogfile().open(logfilename.c_str(), std::fstream::out | std::fstream::binary); if (logfilename.empty() && dual) throw std::runtime_error("dual logging requires file name"); *local_stream << "*** Started logging @"; *local_stream << boost::posix_time::second_clock::local_time(); *local_stream << "with log level: " << getBuffer()[level]; *local_stream << " ***" << Logger::flush; }
void mql4j::config::printConfig() { LOG_INFO << "homeDir = " + getHomeDir(); LOG_INFO << "javaMaxMem = " + getJavaMaxMem(); LOG_INFO << "logfile = " + getLogfile(); LOG_INFO << "logLevel = " + getLogLevel(); }