From f738cbd9a2836e3e4105c43fdf5e81d83ccbe9f9 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Thu, 13 Sep 2012 10:43:25 +0200 Subject: [PATCH] Set a custom logog formatter for the GUI which suppresses file name and line number. --- BaseLib/LogogSimpleFormatter.h | 37 ++++++++++++++++++++++++++++++++++ Gui/main.cpp | 3 +++ 2 files changed, 40 insertions(+) create mode 100644 BaseLib/LogogSimpleFormatter.h diff --git a/BaseLib/LogogSimpleFormatter.h b/BaseLib/LogogSimpleFormatter.h new file mode 100644 index 00000000000..9c1fa64b74a --- /dev/null +++ b/BaseLib/LogogSimpleFormatter.h @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2012, OpenGeoSys Community (http://www.opengeosys.com) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.com/LICENSE.txt + * + * + * \file LogogSimpleFormatter.h + * + * Created on 2012-09-13 by Lars Bilke + */ + +#ifndef LOGOGSIMPLEFORMATTER_H +#define LOGOGSIMPLEFORMATTER_H + +// ** INCLUDES ** +#include "logog.hpp" + +namespace BaseLib { +/** + * \brief LogogSimpleFormatter strips file name and line number from logog output. + * See http://johnwbyrd.github.com/logog/customformatting.html for details. + **/ +class LogogSimpleFormatter : public logog::FormatterMSVC +{ + + virtual TOPIC_FLAGS GetTopicFlags( const logog::Topic &topic ) + { + return ( logog::Formatter::GetTopicFlags( topic ) & + ~( TOPIC_FILE_NAME_FLAG | TOPIC_LINE_NUMBER_FLAG )); + } + +}; + +#endif // LOGOGSIMPLEFORMATTER_H + +} // namespace BaseLib \ No newline at end of file diff --git a/Gui/main.cpp b/Gui/main.cpp index b6d1aedc76c..f094c289bb5 100644 --- a/Gui/main.cpp +++ b/Gui/main.cpp @@ -5,6 +5,7 @@ #include <OpenSG/OSGBaseFunctions.h> #endif #include "logog.hpp" +#include "LogogSimpleFormatter.h" int main(int argc, char* argv[]) { @@ -13,6 +14,8 @@ int main(int argc, char* argv[]) #endif LOGOG_INITIALIZE(); logog::Cout* logogCout = new logog::Cout; + BaseLib::LogogSimpleFormatter formatter; + logogCout->SetFormatter(formatter); QApplication a(argc, argv); setlocale(LC_NUMERIC,"C"); MainWindow* w = new MainWindow(); -- GitLab