From 335380172cf39efb9abccbefe8df872e5086421b Mon Sep 17 00:00:00 2001 From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Tue, 21 Sep 2010 12:34:36 +0000 Subject: [PATCH] updated logging system specifically, remove LOGN_* macros and introduce new logging levels. We now have ERROR, WARNING, INFO, VERBOSE, DEBUG and TRACE. DEBUG and TRACE are turned off under NDEBUG and expand to an empty macro. new default verbosity level displays ERROR/WARNING/INFO git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2709 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/base/doc/logging.rst | 210 ++++++++++++------ modules/base/pymod/__init__.py | 7 + modules/base/pymod/export_logger.cc | 150 ++++--------- .../src/export_helper/generic_property_def.hh | 30 +-- modules/base/src/log.cc | 35 +-- modules/base/src/log.hh | 64 +++--- modules/base/src/log_sink.cc | 28 ++- modules/base/src/log_sink.hh | 42 +--- modules/conop/src/compound_lib.cc | 6 +- modules/conop/src/conop.cc | 6 +- modules/conop/src/heuristic_builder.cc | 60 ++--- modules/conop/src/heuristic_connect.cc | 38 ++-- modules/conop/src/sanitizer.cc | 6 +- modules/gfx/src/bitmap_io.cc | 20 +- modules/gfx/src/entity.cc | 16 +- modules/gfx/src/gfx_object.cc | 24 +- modules/gfx/src/gfx_test_object.cc | 4 +- modules/gfx/src/impl/calc_ambient.cc | 4 +- modules/gfx/src/impl/cgl_offscreen_buffer.cc | 14 +- modules/gfx/src/impl/entity_renderer.hh | 2 +- modules/gfx/src/impl/glx_offscreen_buffer.cc | 28 +-- modules/gfx/src/impl/map_iso_gen.cc | 7 +- modules/gfx/src/map_iso.cc | 2 +- modules/gfx/src/offscreen_buffer.cc | 54 ++--- modules/gfx/src/scene.cc | 61 ++--- modules/gfx/src/shader.cc | 28 +-- modules/gfx/src/vertex_array.cc | 54 ++--- modules/gui/src/file_loader.cc | 6 +- modules/gui/src/gl_canvas.cc | 8 +- modules/gui/src/gl_win.cc | 18 +- modules/gui/src/gosty.cc | 2 +- .../src/python_shell/python_interpreter.cc | 2 +- modules/img/alg/src/discrete_shrink.cc | 4 +- modules/img/alg/src/highest_peak_search_3d.cc | 15 +- modules/img/base/pymod/export_image_handle.cc | 2 - modules/img/base/src/image_handle.cc | 12 - modules/img/base/src/image_handle.hh | 6 - modules/img/base/src/pixel_sampling.cc | 2 +- modules/index.rst | 2 +- modules/io/src/convert.cc | 6 +- modules/io/src/img/load_map.cc | 22 +- modules/io/src/img/map_io_dm3_handler.cc | 80 ++++--- modules/io/src/img/map_io_jpk_handler.cc | 16 +- modules/io/src/img/map_io_mrc_handler.cc | 70 +++--- .../io/src/img/map_io_nanoscope_handler.cc | 22 +- modules/io/src/img/map_io_situs_handler.cc | 6 +- modules/io/src/img/map_io_spi_handler.cc | 16 +- modules/io/src/img/map_io_tiff_handler.cc | 50 ++--- modules/io/src/img/tiff_util.cc | 6 +- modules/io/src/mol/dcd_io.cc | 20 +- modules/io/src/mol/entity_io_crd_handler.cc | 12 +- modules/io/src/mol/entity_io_mae_handler.cc | 30 +-- modules/io/src/mol/load_entity.cc | 10 +- modules/io/src/mol/load_surface.cc | 5 +- modules/io/src/mol/pdb_reader.cc | 30 +-- modules/io/src/mol/save_entity.cc | 4 +- modules/io/src/mol/sdf_reader.cc | 18 +- modules/io/src/mol/surface_io_msms_handler.cc | 8 +- modules/mol/base/pymod/bounds.hh | 12 +- modules/mol/base/src/coord_source.cc | 4 +- modules/mol/base/src/impl/atom_impl.cc | 8 +- modules/mol/base/src/impl/chain_impl.cc | 4 +- modules/mol/base/src/impl/connector_impl.cc | 4 +- modules/mol/base/src/impl/dihedral.cc | 2 +- modules/mol/base/src/impl/entity_impl.cc | 82 +++---- modules/mol/base/src/impl/residue_impl.cc | 12 +- modules/mol/base/src/impl/torsion_impl.cc | 2 +- modules/mol/base/src/surface_builder.cc | 2 +- modules/qa/src/packing_statistics.cc | 2 +- modules/qa/src/solis_torsion_potential.cc | 2 +- modules/qa/src/torsion_potential.cc | 2 +- scripts/init.py | 4 +- scripts/init_cl.py | 2 +- 73 files changed, 804 insertions(+), 850 deletions(-) diff --git a/modules/base/doc/logging.rst b/modules/base/doc/logging.rst index 726b60acb..8e7ebe76d 100644 --- a/modules/base/doc/logging.rst +++ b/modules/base/doc/logging.rst @@ -3,111 +3,187 @@ Logging .. currentmodule:: ost -How to log messages --------------------------------------------------------------------------------- - -OpenStructure has an easy to use Logging API. Depended on how severe the message -is, one of the following four methods can be used to log the message: +OpenStructure has a logging system going beyond what print statements can offer. Messages can be logged to the terminal to the graphical user interface or a file. Depending on the needs, groups of messages can be turned and off. - .. method:: LogError(message) +.. function:: LogError(message) + LogWarning(message) + LogInfo(message) + LogVerbose(message) - Use this Method to log whenever an error occured that may cause the - application to fail - - .. method:: LogMessage(message) + Add a message to the log. For the choice of the appropriate logging level, + see :ref:`picking-logging-level`. - Use this Method to warn the user that something went wrong but generally does - not pose a threat to the stability of the application - - .. method:: LogVerbose(message) + :param message: The message to be logged + :type message: str - Use this Method to inform the user about processed data - - .. method:: LogDebug(message) - - Use this Method for informational messages that can help debug the program +.. note:: + + In C++, the logging facility is implemented as a set of macros, called + `LOG_ERROR`, `LOG_WARNING`, `LOG_INFO`, `LOG_VERBOSE`, `LOG_DEBUG` and + `LOG_TRACE`. The last two are only active when compiling with debugging + symbols. When debugging symbols are off, they expand to an empty macro and + thus don't create any overhead. + + +Verbosity Level +-------------------------------------------------------------------------------- + +You can change the verbosity level with the following two methods: + +.. function:: PushVerbosityLevel(verbosity) + + Change the verbosity level to the given integer value. All log events + which have a severity above verbosity will be ignored. By default, the log + level is 2, meaning that errors, warnings and info logging events are + visible. + + :type verbosity: :class:`int` +.. function:: PopVerbosityLevel() + Change the log level back to the previous verbosity level. It is an error to + pop the verbosity level without a matching call to + :func:`PushVerbosityLevel`. + Log sinks -------------------------------------------------------------------------------- -It is possible to log into different log backends namely log sinks. Log sink classes -define, how to handle log messages: +When running OpenStructure from the command-line, the log messages are by +default output to stderr. When running DNG, the log messages are additionally +logged to the messages widget. However, it is also possible to log into a file +or theoretically even to a remote computer. All these are instances of so-called +log sinks: classes that derive from LogSink and implement the LogMessage method. + .. class:: LogSink .. method:: LogMessage(message, severity) - This method is called whenever something has been logged. This i a pure virtual - function therefore it must be overloaded in base classes. + This method is called whenever something gets logged. This method must be + implemented by all subclasses. :param message: The logged message :type message: :class:`str` - :param severity: Marks how severe the logged message is, starts from 0 which - is really important. Value is always 0 or larger + :param severity: Marks how severe the logged message is. Errors have + severity 0, warnings 1 etc. :type severity: :data:`int` -There are four LogSink implementations available in OpenStructure: - -.. class:: FileLogSink +For convenience, there are 3 LogSink implementations available in OpenStructure that are sufficient for most use cases. - The FileLogSink logs all messages into the given file. +.. class:: FileLogSink(filename) -.. class:: NullLogSink + The FileLogSink logs all messages into the given file. + + :param filename: The filename + :type filename: :class:`str` - The NullLogSink suppresses all LogMessages +.. class:: StreamLogSink(stream) -.. class:: ObservedLogSink + The stream log sink writes all log messages to the stream. stream must have a + write method that accepts a string. To write messages to stderr, use + + .. code-block:: python + + stderr_sink=ost.StreamLogSink(sys.stderr) + ost.PushLogSink(stderr_sink) + ost.LogInfo('Welcome, master') + +.. class:: MultiLogSink - An observed LogSink allows to log into multiple sinks. + A LogSink for multiplexing the log messages into multiple sinks at the same + time, e.g. the terminal and the messages widget. - .. method:: AttachObserver(sink) + .. method:: AddSink(sink) - Attach an Observer which will be called whenever something has been logged + Add a new sink. The sink's :meth:`LogSink.LogMessage` method will be called + every time something gets logged. - .. method:: RemoveObserver(sink) + :type sink: :class:`~ost.LogSink` + :param sink: the log sink to be added + + .. method:: RemoveSink(sink) - Removes the given sink it will no longer be called when something has been logged + Remove the given sink. If the doesn't exist, this method has no effect. + + :type sink: :class:`~ost.LogSink` + :param sink: the log sink to be removed + -The following snippet explains how to create a custom log sink which logs to the python shell: +To change the current log sink you can use the following methods: -.. code-block:: python - - class PyLogger(ost.LogSink): - def __init__(self): - ost.LogSink.__init__(self) - - def LogMessage(self, message, severity): - print severity, message +.. method:: PushLogSink(sink) + Push the new sink onto the log sink stack. All of the messages will now be + logged to the new sink. To switch back to the previous log sink, use + :func:`PopLogSink`. -To change the logger you can use the following methods: +.. method:: PopLogSink() - .. method:: PushLogSink(sink) - - Change the log sink to the given sink + Change the log sink back to the previous one. It is an error to pop the log + sink when there is only one log sink on the stack. - .. method:: PopLogSink() - - Change the log sink back to the previous sink - +.. _picking-logging-level: -Verbosity Level +Guidelines for picking logging level -------------------------------------------------------------------------------- -You can set the verbosity level of the Logger with the following methods: +Each logging event has an associated level that marks its importance. For example, users should always see errors, but they do not need to see detailed information on the loading process. Here is a list of guidelines that we use in the code. We encourage developers to adhere to these guidelines as closely as possible. - .. method:: PushVerbosityLevel(verbosity): - - Change the Verbosity Level to the given integer value. All LoggedMethods which - have a severity above verbosity will not be passed to the current log sink. - - :type verbosity: :data:`int` - - .. method:: PopVerbosityLevel(): - - Change the log sink back to the previous verbosity level - \ No newline at end of file +ERROR: + Cannot be silenced, very important message to the user, some command did not + complete as expected or was aborted. + +WARNING: + Diagnose potential problems that do not abort the execution, but may + point to a misconfiguration/misuse. This level is turned on by default. + +INFO: + Informative and important messages that summarize a complex command, such as + information on a loaded file, or results from an algorithm. These logging + messages are turned on by default. + +VERBOSE: + Grey-zone between user and developer need, and perhaps the hardest to get + right. This is the lowest logging level users will be able to see when they + use an optimized build. An example for this is the OpenGL setup/info in gfx, + or the path search during startup, or more detailed info on file IO. These + messages are not turned on by default. + +DEBUG: + For developers, but not quite at the trace level. This level is turned off by + default, not available in Python and only enabled when compiling with + debugging symbols. + +TRACE: + Used to debug inner loops. Once turned on, you will probably get more debug + output that you will be able to handle. This level is turned off by default, + not available in python and only enabled when compiling with debugging + symbols. + + +Example +-------------------------------------------------------------------------------- + +The following snippet explains how to create a custom log sink which logs to the +terminal (or the python shell in DNG). The logger also prints the current time. + +.. code-block:: python + + import datetime + class PyLogger(ost.LogSink): + def __init__(self): + ost.LogSink.__init__(self) + + def LogMessage(self, message, severity): + levels=['ERROR', 'WARNING', 'INFO', + 'VERBOSE', 'DEBUG', 'TRACE'] + level=levels[severity] + print '%s[%s]: %s' % (level, str(datetime.datetime.now()), message), + + py_logger=PyLogger() + ost.PushLogSink(py_logger) + + ost.LogInfo("amazing logging system") \ No newline at end of file diff --git a/modules/base/pymod/__init__.py b/modules/base/pymod/__init__.py index aa723917b..c6d7a8ec1 100644 --- a/modules/base/pymod/__init__.py +++ b/modules/base/pymod/__init__.py @@ -36,3 +36,10 @@ try: except ImportError: pass + +class StreamLogSink(LogSink): + def __init__(self, stream): + LogSink.__init__(self) + self._stream=stream + def LogMessage(self, message, level): + self._stream.write(message) diff --git a/modules/base/pymod/export_logger.cc b/modules/base/pymod/export_logger.cc index a6d408119..8c00f377d 100644 --- a/modules/base/pymod/export_logger.cc +++ b/modules/base/pymod/export_logger.cc @@ -28,13 +28,22 @@ using namespace ost; namespace { -struct WrappedLogSink : public LogSink, wrapper<LogSink> -{ - virtual void LogMessage(const String& message , int severity) { - call<void>(this->get_override("LogMessage").ptr(),message,severity); - } +struct WrappedLogSink : public LogSink { + WrappedLogSink(PyObject* self): self_(self) + { } + virtual void LogMessage(const String& message , int severity) + { + call_method<void>(self_, "LogMessage", message, severity); + } + + void LogMessageDefault(const String& message, int severity) + { + } + PyObject* self_; }; + + typedef boost::shared_ptr<WrappedLogSink> WrappedLogSinkPtr; void push_verb(int n) @@ -51,9 +60,9 @@ void pop_verb() Logger::Instance().PopVerbosityLevel(); } -void pop_verb_file() +void push_log_sink(LogSinkPtr sink) { - Logger::Instance().PopFile(); + Logger::Instance().PushSink(sink); } void pop_log_sink() @@ -61,121 +70,52 @@ void pop_log_sink() Logger::Instance().PopSink(); } -void push_verb_file(const String& filename) -{ - Logger::Instance().PushFile(filename); -} -void push_log_sink_1(LogSinkPtr& sink) -{ - Logger::Instance().PushSink(sink); -} +void log_error(const String& m) {LOG_ERROR(m);} +void log_warning(const String& m) {LOG_WARNING(m);} +void log_info(const String& m) {LOG_INFO(m);} +void log_verbose(const String& m) {LOG_VERBOSE(m);} -void push_log_sink_2(WrappedLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - Logger::Instance().PushSink(lsp); -} - -void push_log_sink_3(ObservableLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - Logger::Instance().PushSink(lsp); -} -void push_log_sink_4(FileLogSinkPtr& sink) +void reset_sinks() { - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - Logger::Instance().PushSink(lsp); + Logger::Instance().ResetSinks(); } - -void push_log_sink_5(NullLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - Logger::Instance().PushSink(lsp); -} - -void add_observer_1(ObservableLogSinkPtr& obs_sink, WrappedLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - obs_sink->AddObserver(lsp); -} - -void add_observer_2(ObservableLogSinkPtr& obs_sink, FileLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - obs_sink->AddObserver(lsp); -} - -void add_observer_3(ObservableLogSinkPtr& obs_sink, NullLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - obs_sink->AddObserver(lsp); -} - -void remove_observer_1(ObservableLogSinkPtr& obs_sink, WrappedLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - obs_sink->RemoveObserver(lsp); -} - -void remove_observer_2(ObservableLogSinkPtr& obs_sink, FileLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - obs_sink->RemoveObserver(lsp); -} - -void remove_observer_3(ObservableLogSinkPtr& obs_sink, NullLogSinkPtr& sink) -{ - LogSinkPtr lsp = dyn_cast<LogSink>(sink); - obs_sink->RemoveObserver(lsp); -} - -void log_error(const String& m) {LOGN_ERROR(m);} -void log_message(const String& m) {LOGN_MESSAGE(m);} -void log_verbose(const String& m) {LOGN_VERBOSE(m);} -void log_debug(const String& m) {LOGN_DEBUG(m);} - } void export_Logger() { - class_<WrappedLogSink, WrappedLogSinkPtr, LogSink, boost::noncopyable>("LogSink",init<>()) - .def("LogMessage",pure_virtual(&WrappedLogSink::LogMessage)) - ; - - class_<ObservableLogSink, ObservableLogSinkPtr, bases<LogSink>, boost::noncopyable >("ObservableLogSink", init<>()) - .def("LogMessage",&ObservableLogSink::LogMessage) - .def("AddObserver",&ObservableLogSink::AddObserver) - .def("AddObserver",add_observer_1) - .def("AddObserver",add_observer_2) - .def("AddObserver",add_observer_3) - .def("RemoveObserver",&ObservableLogSink::RemoveObserver) - .def("RemoveObserver",remove_observer_1) - .def("RemoveObserver",remove_observer_2) - .def("RemoveObserver",remove_observer_3) + class_<LogSink, WrappedLogSinkPtr, + boost::noncopyable>("LogSink") + .def("LogMessage", &WrappedLogSink::LogMessageDefault) ; - class_<FileLogSink, FileLogSinkPtr, bases<LogSink>, boost::noncopyable >("FileLogSink", init<const String&>()) - .def("LogMessage",&FileLogSink::LogMessage) + class_<MultiLogSink, MultiLogSinkPtr, bases<LogSink>, + boost::noncopyable >("MultiLogSink", init<>()) + .def("AddSink",&MultiLogSink::AddSink) + .def("RemoveSink",&MultiLogSink::RemoveSink) + .def("LogMessage", &MultiLogSink::LogMessage) ; - class_<NullLogSink, NullLogSinkPtr, bases<LogSink>, boost::noncopyable >("NullLogSink", init<>()) - .def("LogMessage",&NullLogSink::LogMessage) + class_<FileLogSink, FileLogSinkPtr, bases<LogSink>, + boost::noncopyable >("FileLogSink", init<const String&>()) + .def("LogMessage", &FileLogSink::LogMessage) ; def("PushVerbosityLevel",push_verb); def("PopVerbosityLevel",pop_verb); - def("PushVerbosityFile",push_verb_file); - def("PopVerbosityFile",pop_verb_file); - def("PushLogSink",push_log_sink_1); - def("PushLogSink",push_log_sink_2); - def("PushLogSink",push_log_sink_3); - def("PushLogSink",push_log_sink_4); - def("PushLogSink",push_log_sink_5); + def("PushLogSink",push_log_sink); def("PopLogSink",pop_log_sink); def("LogError",log_error); - def("LogMessage",log_message); - def("LogVerbose",log_verbose); - def("LogDebug",log_debug); + def("LogWarning",log_warning); + def("LogInfo",log_info); + def("LogVerbose", log_verbose); + + // this relatively ugly construct is required to work around a problem with + // the "ost" command-line interpreter. If we don't remove all the sinks from + // the sink stack, we will get "Fatal Python error: PyEval_SaveThread: + // NULL tstate" upon exiting ost. I don't completely understand why, though. + scope().attr("__dict__")["atexit"]=import("atexit"); + def("_reset_sinks", &reset_sinks); + exec("atexit.register(_reset_sinks)", scope().attr("__dict__")); } diff --git a/modules/base/src/export_helper/generic_property_def.hh b/modules/base/src/export_helper/generic_property_def.hh index 11c5dfb80..785bcce90 100644 --- a/modules/base/src/export_helper/generic_property_def.hh +++ b/modules/base/src/export_helper/generic_property_def.hh @@ -28,105 +28,105 @@ template <typename C> String depr_get_string_a(C& c, const String& k, const String& v) { - LOGN_MESSAGE("GetGenericStringProperty is deprecated. Use GetStringProp"); + WARN_DEPRECATED("GetGenericStringProperty is deprecated. Use GetStringProp"); return c.GetStringProp(k, v); } template <typename C> String depr_get_string_b(C& c, const String& k) { - LOGN_MESSAGE("GetGenericStringProperty is deprecated. Use GetStringProp"); + WARN_DEPRECATED("GetGenericStringProperty is deprecated. Use GetStringProp"); return c.GetStringProp(k); } template <typename C> void depr_set_string(C& c, const String& k, const String& v) { - LOGN_MESSAGE("SetGenericStringProperty is deprecated. Use SetStringProp"); + WARN_DEPRECATED("SetGenericStringProperty is deprecated. Use SetStringProp"); return c.SetStringProp(k, v); } template <typename C> int depr_get_int_a(C& c, const String& k, const int& v) { - LOGN_MESSAGE("GetGenericIntProperty is deprecated. Use GetIntProp"); + WARN_DEPRECATED("GetGenericIntProperty is deprecated. Use GetIntProp"); return c.GetIntProp(k, v); } template <typename C> int depr_get_int_b(C& c, const String& k) { - LOGN_MESSAGE("GetGenericIntProperty is deprecated. Use GetIntProp"); + WARN_DEPRECATED("GetGenericIntProperty is deprecated. Use GetIntProp"); return c.GetIntProp(k); } template <typename C> void depr_set_int(C& c, const String& k, const int& v) { - LOGN_MESSAGE("SetGenericIntProperty is deprecated. Use SetIntProp"); + WARN_DEPRECATED("SetGenericIntProperty is deprecated. Use SetIntProp"); return c.SetIntProp(k, v); } template <typename C> bool depr_get_bool_a(C& c, const String& k, const bool& v) { - LOGN_MESSAGE("GetGenericBoolProperty is deprecated. Use GetBoolProp"); + WARN_DEPRECATED("GetGenericBoolProperty is deprecated. Use GetBoolProp"); return c.GetBoolProp(k, v); } template <typename C> bool depr_get_bool_b(C& c, const String& k) { - LOGN_MESSAGE("GetGenericBoolProperty is deprecated. Use GetBoolProp"); + WARN_DEPRECATED("GetGenericBoolProperty is deprecated. Use GetBoolProp"); return c.GetBoolProp(k); } template <typename C> void depr_set_bool(C& c, const String& k, const bool& v) { - LOGN_MESSAGE("SetGenericBoolProperty is deprecated. Use SetBoolProp"); + WARN_DEPRECATED("SetGenericBoolProperty is deprecated. Use SetBoolProp"); return c.SetBoolProp(k, v); } template <typename C> Real depr_get_float_a(C& c, const String& k, const float& v) { - LOGN_MESSAGE("GetGenericFloatProperty is deprecated. Use GetFloatProp"); + WARN_DEPRECATED("GetGenericFloatProperty is deprecated. Use GetFloatProp"); return c.GetFloatProp(k, v); } template <typename C> Real depr_get_float_b(C& c, const String& k) { - LOGN_MESSAGE("GetGenericFloatProperty is deprecated. Use GetFloatProp"); + WARN_DEPRECATED("GetGenericFloatProperty is deprecated. Use GetFloatProp"); return c.GetFloatProp(k); } template <typename C> void depr_set_float(C& c, const String& k, const Real& v) { - LOGN_MESSAGE("SetGenericFloatProperty is deprecated. Use SetFloatProp"); + WARN_DEPRECATED("SetGenericFloatProperty is deprecated. Use SetFloatProp"); return c.SetFloatProp(k, v); } template <typename C> void depr_clear_props(C& c) { - LOGN_MESSAGE("ClearGenericProperties is deprecated. Use ClearProps"); + WARN_DEPRECATED("ClearGenericProperties is deprecated. Use ClearProps"); c.ClearProps(); } template <typename C> bool depr_has_prop(C& c, const String& k) { - LOGN_MESSAGE("HasGenericProperty is deprecated. Use HasProp"); + WARN_DEPRECATED("HasGenericProperty is deprecated. Use HasProp"); return c.HasProp(k); } template <typename C> String depr_prop_as_string(C& c, const String& k) { - LOGN_MESSAGE("GetGenericPropertyStringRepresentation is deprecated. Use GetPropAsString"); + WARN_DEPRECATED("GetGenericPropertyStringRepresentation is deprecated. Use GetPropAsString"); return c.GetPropAsString(k); } diff --git a/modules/base/src/log.cc b/modules/base/src/log.cc index 14bc027ae..55d348b75 100644 --- a/modules/base/src/log.cc +++ b/modules/base/src/log.cc @@ -32,23 +32,17 @@ Logger& Logger::Instance() Logger::Logger(): level_(0), level_stack_(), - sink_stack_(), - null_sink_(new NullLogSink()), - sink_() + sink_stack_() { - sink_stack_.push(LogSinkPtr(new StdLogSink(std::cerr))); - sink_= sink_stack_.top(); + sink_stack_.push(LogSinkPtr(new StreamLogSink(std::cerr))); } Logger::Logger(const Logger&): level_(0), level_stack_(), - sink_stack_(), - null_sink_(new NullLogSink()), - sink_() + sink_stack_() { - sink_stack_.push(LogSinkPtr(new StdLogSink(std::cerr))); - sink_= sink_stack_.top(); + sink_stack_.push(LogSinkPtr(new StreamLogSink(std::cerr))); } Logger& Logger::operator=(const Logger&) @@ -74,39 +68,28 @@ void Logger::PopVerbosityLevel() } } -LogSinkPtr& Logger::operator()(enum LogLevel l) -{ - if(l<=level_) { - return sink_; - } - return null_sink_; -} - void Logger::PushFile(const String& fn) { sink_stack_.push(LogSinkPtr(new FileLogSink(fn))); - sink_ = sink_stack_.top(); } void Logger::PopFile() { - if(sink_stack_.size()>1) { - sink_stack_.pop(); - sink_ = sink_stack_.top(); - } + WARN_DEPRECATED("Logger::PopFile is deprecated. Use Logger::PopSink instead"); + this->PopSink(); } void Logger::PushSink(LogSinkPtr& sink) { sink_stack_.push(sink); - sink_ = sink_stack_.top(); } void Logger::PopSink() { if(sink_stack_.size()>1) { - sink_stack_.pop(); - sink_ = sink_stack_.top(); + sink_stack_.pop(); + } else { + LOG_ERROR("Can't pop sink. There is only one sink left on the stack"); } } diff --git a/modules/base/src/log.hh b/modules/base/src/log.hh index edaee14d1..4ed5c7ed5 100644 --- a/modules/base/src/log.hh +++ b/modules/base/src/log.hh @@ -33,12 +33,12 @@ typedef std::stack<LogSinkPtr> LogSinkStack; class DLLEXPORT_OST_BASE Logger { public: enum LogLevel { - QUIET=0, - NORMAL, - VERBOSE, - DEBUG, - DUMP, - TRACE + QUIET =0, + WARNING =1, + INFO =2, + VERBOSE =3, + DEBUG =4, + TRACE =5 }; void PushVerbosityLevel(int level); @@ -48,12 +48,16 @@ public: //! DEPRECATED use PopSink() instead void PopFile(); void PopSink(); - LogSinkPtr& operator()(enum LogLevel); static Logger& Instance(); - + LogSinkPtr GetCurrentSink() { return sink_stack_.top(); } int GetLogLevel() const {return level_;} - + + void ResetSinks() { + while (sink_stack_.size()>1) { + sink_stack_.pop(); + } + } protected: Logger(); Logger(const Logger&); @@ -63,41 +67,29 @@ private: int level_; std::stack<int> level_stack_; LogSinkStack sink_stack_; - LogSinkPtr null_sink_; - LogSinkPtr sink_; }; -#define PUSH_VERBOSITY(n) ::ost::Logger::Instance().PushVerbosityLevel(n) -#define POP_VERBOSITY(n) ::ost::Logger::Instance().PopVerbosityLevel() - -#define LOG_ERROR(m) if(true){std::stringstream tmp_stream__;tmp_stream__ << m ;::ost::Logger::Instance()(::ost::Logger::QUIET)->LogMessage(tmp_stream__.str());} -#define LOGN_ERROR(m) if(true){std::stringstream tmp_stream__;tmp_stream__ << m << std::endl;::ost::Logger::Instance()(::ost::Logger::QUIET)->LogMessage(tmp_stream__.str());} -#define LOG_MESSAGE(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::NORMAL) {std::stringstream tmp_stream__;tmp_stream__ << m ;::ost::Logger::Instance()(::ost::Logger::NORMAL)->LogMessage(tmp_stream__.str(),::ost::Logger::NORMAL);} -#define LOGN_MESSAGE(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::NORMAL) {std::stringstream tmp_stream__; tmp_stream__ << m <<std::endl;::ost::Logger::Instance()(::ost::Logger::NORMAL)->LogMessage(tmp_stream__.str(),::ost::Logger::NORMAL);} +#define OST_DO_LOGGING_(m, l) if (::ost::Logger::Instance().GetLogLevel()>=l) {\ + std::stringstream tmp_s__; \ + tmp_s__ << m << std::endl; \ + ::ost::Logger::Instance().GetCurrentSink()->LogMessage(tmp_s__.str(), l); \ + } -#define LOG_VERBOSE(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::VERBOSE) {std::stringstream tmp_stream__;tmp_stream__ << m ;::ost::Logger::Instance()(::ost::Logger::VERBOSE)->LogMessage(tmp_stream__.str(),::ost::Logger::VERBOSE);} -#define LOGN_VERBOSE(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::VERBOSE) {std::stringstream tmp_stream__; tmp_stream__ << m <<std::endl;::ost::Logger::Instance()(::ost::Logger::VERBOSE)->LogMessage(tmp_stream__.str(),::ost::Logger::VERBOSE);} - -#define LOG_DEBUG(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::DEBUG) {std::stringstream tmp_stream__;tmp_stream__ << m ;::ost::Logger::Instance()(::ost::Logger::DEBUG)->LogMessage(tmp_stream__.str(),::ost::Logger::DEBUG);} -#define LOGN_DEBUG(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::DEBUG) {std::stringstream tmp_stream__; tmp_stream__ << m <<std::endl;::ost::Logger::Instance()(::ost::Logger::DEBUG)->LogMessage(tmp_stream__.str(),::ost::Logger::DEBUG);} +#define WARN_DEPRECATED(m) OST_DO_LOGGING_(m, ::ost::Logger::WARNING) +#define PUSH_VERBOSITY(n) ::ost::Logger::Instance().PushVerbosityLevel(n) +#define POP_VERBOSITY(n) ::ost::Logger::Instance().PopVerbosityLevel() +#define LOG_ERROR(m) OST_DO_LOGGING_(m, ::ost::Logger::QUIET) +#define LOG_WARNING(m) OST_DO_LOGGING_(m, ::ost::Logger::WARNING) +#define LOG_INFO(m) OST_DO_LOGGING_(m, ::ost::Logger::INFO) +#define LOG_VERBOSE(m) OST_DO_LOGGING_(m, ::ost::Logger::VERBOSE) #ifdef NDEBUG - -# define LOG_DUMP(m) -# define LOGN_DUMP(m) - +# define LOG_DEBUG(m) # define LOG_TRACE(m) -# define LOGN_TRACE(m) - #else - -# define LOG_DUMP(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::DUMP) {std::stringstream tmp_stream__;tmp_stream__ << m ;::ost::Logger::Instance()(::ost::Logger::DUMP)->LogMessage(tmp_stream__.str(),::ost::Logger::DUMP);} -# define LOGN_DUMP(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::DUMP) {std::stringstream tmp_stream__; tmp_stream__ << m <<std::endl;::ost::Logger::Instance()(::ost::Logger::DUMP)->LogMessage(tmp_stream__.str(),::ost::Logger::DUMP);} - -# define LOG_TRACE(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::TRACE) {std::stringstream tmp_stream__;tmp_stream__ << m ;::ost::Logger::Instance()(::ost::Logger::TRACE)->LogMessage(tmp_stream__.str(),::ost::Logger::TRACE);} -# define LOGN_TRACE(m) if(::ost::Logger::Instance().GetLogLevel()>=::ost::Logger::TRACE) {std::stringstream tmp_stream__; tmp_stream__ << m <<std::endl;::ost::Logger::Instance()(::ost::Logger::TRACE)->LogMessage(tmp_stream__.str(),::ost::Logger::TRACE);} - +# define LOG_DEBUG(m) OST_DO_LOGGING_(m, ::ost::Logger::DEBUG) +# define LOG_TRACE(m) OST_DO_LOGGING_(m, ::ost::Logger::TRACE) #endif } diff --git a/modules/base/src/log_sink.cc b/modules/base/src/log_sink.cc index e784ea8ed..9dad7e5e2 100644 --- a/modules/base/src/log_sink.cc +++ b/modules/base/src/log_sink.cc @@ -21,32 +21,30 @@ #include <iostream> namespace ost { -ObservableLogSink::ObservableLogSink(){} +MultiLogSink::MultiLogSink(){} -bool ObservableLogSink::AddObserver(LogSinkPtr& observer){ - if((std::find( this->observers_.begin(), this->observers_.end(), observer )) == this->observers_.end()) - { - this->observers_.push_back( observer ); +bool MultiLogSink::AddSink(LogSinkPtr& sink) { + if ((std::find( sinks_.begin(), sinks_.end(), sink))==sinks_.end()) { + sinks_.push_back(sink); return true; } return false; } -bool ObservableLogSink::RemoveObserver(LogSinkPtr& observer){ - std::vector<LogSinkPtr>::iterator found = std::find( this->observers_.begin(), this->observers_.end(), observer); - if( found != this->observers_.end() ){ - this->observers_.erase(found); +bool MultiLogSink::RemoveSink(LogSinkPtr& sink){ + std::vector<LogSinkPtr>::iterator found=std::find(sinks_.begin(), + sinks_.end(), sink); + if (found!=sinks_.end() ){ + sinks_.erase(found); return true; } return false; } -void ObservableLogSink::LogMessage(const String& message, int severity){ - std::vector<LogSinkPtr>::const_iterator observers_it = this->observers_.begin() ; - while( observers_it != this->observers_.end() ) - { - ( *observers_it )->LogMessage(message, severity); - observers_it++; +void MultiLogSink::LogMessage(const String& message, int severity){ + for (std::vector<LogSinkPtr>::const_iterator + i=sinks_.begin(), e=sinks_.end(); i!=e; ++i) { + (*i)->LogMessage(message, severity); } } diff --git a/modules/base/src/log_sink.hh b/modules/base/src/log_sink.hh index 5710168ec..4878d7f4a 100644 --- a/modules/base/src/log_sink.hh +++ b/modules/base/src/log_sink.hh @@ -31,42 +31,18 @@ namespace ost { -namespace impl{ - - class DLLEXPORT DevNull: public std::streambuf { - protected: - virtual int_type overflow(int_type c) {return c;} - virtual std::streamsize xsputn(const char* s, std::streamsize num) {return num;} - }; - -} // anon ns - class DLLEXPORT LogSink { public: LogSink(){}; virtual ~LogSink() { } - virtual void LogMessage(const String& message, int severity = 0)=0; + virtual void LogMessage(const String& message, int severity=0)=0; }; typedef boost::shared_ptr<LogSink> LogSinkPtr; -class DLLEXPORT NullLogSink : public LogSink { -public: - NullLogSink():null_(new impl::DevNull()){} - virtual void LogMessage(const String& message, int severity){null_ << message;} - ~NullLogSink(){ - null_.flush(); - delete null_.rdbuf(); - } -private: - std::ostream null_; -}; - -typedef boost::shared_ptr<NullLogSink> NullLogSinkPtr; - -class DLLEXPORT StdLogSink : public LogSink { +class DLLEXPORT StreamLogSink : public LogSink { public: - StdLogSink(std::ostream& stream):stream_(stream){} + StreamLogSink(std::ostream& stream):stream_(stream){} virtual void LogMessage(const String& message, int severity){ stream_ << message; } @@ -95,17 +71,17 @@ private: typedef boost::shared_ptr<FileLogSink> FileLogSinkPtr; -class DLLEXPORT_OST_BASE ObservableLogSink : public LogSink { +class DLLEXPORT_OST_BASE MultiLogSink : public LogSink { public: - ObservableLogSink(); - bool AddObserver(LogSinkPtr& observer); - bool RemoveObserver(LogSinkPtr& observer); + MultiLogSink(); + bool AddSink(LogSinkPtr& observer); + bool RemoveSink(LogSinkPtr& observer); void LogMessage(const String& message, int severity); private: - std::vector<LogSinkPtr> observers_; + std::vector<LogSinkPtr> sinks_; }; -typedef boost::shared_ptr<ObservableLogSink> ObservableLogSinkPtr; +typedef boost::shared_ptr<MultiLogSink> MultiLogSinkPtr; } #endif diff --git a/modules/conop/src/compound_lib.cc b/modules/conop/src/compound_lib.cc index a5c9ad1a7..75cfbd804 100644 --- a/modules/conop/src/compound_lib.cc +++ b/modules/conop/src/compound_lib.cc @@ -120,16 +120,16 @@ void CompoundLib::AddCompound(const CompoundPtr& compound) date=ss.str(); sqlite3_bind_text(stmt, 6, date.c_str(), date.length(), NULL); } else { - LOGN_ERROR(sqlite3_errmsg(conn_)); + LOG_ERROR(sqlite3_errmsg(conn_)); sqlite3_finalize(stmt); return; } retval=sqlite3_step(stmt); if (SQLITE_DONE!=retval) { if (sqlite3_errcode(conn_)==SQLITE_CONSTRAINT) { - LOGN_ERROR("Compound '" << compound->GetID() << "' already exists."); + LOG_ERROR("Compound '" << compound->GetID() << "' already exists."); } else { - LOGN_ERROR(sqlite3_errmsg(conn_)); + LOG_ERROR(sqlite3_errmsg(conn_)); } } sqlite3_finalize(stmt); diff --git a/modules/conop/src/conop.cc b/modules/conop/src/conop.cc index cb19a99bf..7d8b35867 100644 --- a/modules/conop/src/conop.cc +++ b/modules/conop/src/conop.cc @@ -279,15 +279,15 @@ private: void Conopology::ConnectAll(const BuilderP& b, mol::EntityHandle eh, int flag) { Profile profile_connect("ConnectAll"); - LOGN_DEBUG("Conopology: ConnectAll: building internal coordinate system"); + LOG_DEBUG("Conopology: ConnectAll: building internal coordinate system"); mol::XCSEditor xcs_e=eh.RequestXCSEditor(mol::BUFFERED_EDIT); PropAssigner a(b); eh.Apply(a); - LOGN_DUMP("Conopology: ConnectAll: connecting all bonds"); + LOG_DEBUG("Conopology: ConnectAll: connecting all bonds"); Connector connector(b); eh.Apply(connector); - LOGN_DUMP("Conopology: ConnectAll: assigning all torsions"); + LOG_DEBUG("Conopology: ConnectAll: assigning all torsions"); TorsionMaker tmaker(b); eh.Apply(tmaker); } diff --git a/modules/conop/src/heuristic_builder.cc b/modules/conop/src/heuristic_builder.cc index 644771764..03398956f 100644 --- a/modules/conop/src/heuristic_builder.cc +++ b/modules/conop/src/heuristic_builder.cc @@ -113,13 +113,13 @@ HeuristicBuilder::HeuristicBuilder(): { int def_entry_count = sizeof(heuristic_connect::def_entry_table)/sizeof(heuristic_connect::CONN_DEF_ENTRY); - LOGN_DEBUG("importing internal connectivity tables"); + LOG_DEBUG("importing internal connectivity tables"); for(int ec=0;ec<def_entry_count;++ec) { heuristic_connect::CONN_DEF_ENTRY& def_entry = heuristic_connect::def_entry_table[ec]; detail::ConnResEntry entry(def_entry.abbrev, def_entry.single, def_entry.chem_class); - LOGN_DUMP("creating table entry for " << def_entry.abbrev); - LOGN_DUMP("working on bond entries"); + LOG_DEBUG("creating table entry for " << def_entry.abbrev); + LOG_DEBUG("working on bond entries"); for (int xx=0;xx<def_entry.name_count;++xx) { String name=def_entry.name_list[xx]; if (name!="OXT") @@ -151,14 +151,14 @@ HeuristicBuilder::HeuristicBuilder(): else if(conn_nam[1]==String("-")) { entry.SetPrev(conn_nam[0]);} else if(conn_nam[0]==String("+")) { entry.SetNext(conn_nam[1]);} else if(conn_nam[1]==String("+")) { entry.SetNext(conn_nam[0]);} - LOGN_DUMP(" " << conn_nam[0] << " " << conn_nam[1]); + LOG_DEBUG(" " << conn_nam[0] << " " << conn_nam[1]); } else { - LOGN_DUMP(" " << conn_nam[0] << " " << conn_nam[1]); + LOG_DEBUG(" " << conn_nam[0] << " " << conn_nam[1]); entry.AddConn(conn_nam[0],conn_nam[1]); } } // then the torsion entries - LOGN_DUMP("working on torsion entries"); + LOG_DEBUG("working on torsion entries"); for(int cc=0;cc<def_entry.tor_count;++cc) { int tor_id[] = {def_entry.tor_list[cc].n1, def_entry.tor_list[cc].n2, @@ -183,7 +183,7 @@ HeuristicBuilder::HeuristicBuilder(): emap_[def_entry.abbrev]=entry; } - LOGN_DUMP("done importing internal tables"); + LOG_DEBUG("done importing internal tables"); } HeuristicBuilder::~HeuristicBuilder() @@ -201,18 +201,18 @@ void HeuristicBuilder::ConnectivityFromAtomNames(const mol::ResidueHandle& res, mol::AtomHandleList::iterator it2=it1; ++it2; for (;it2!=atomlist.end();++it2) { - LOG_DUMP("checking for atom pair (" << it1->GetName() << "," + LOG_DEBUG("checking for atom pair (" << it1->GetName() << "," << it2->GetName() << ") in connectivity table of " << res.GetKey() << "... "); int conn=centry.Check(it1->GetName(),it2->GetName()); if (conn==1 && this->IsBondFeasible(*it1, *it2)) { - LOGN_DUMP( "found"); + LOG_DEBUG( "found"); editor.Connect(*it1,*it2); } else if(conn==2 && this->IsBondFeasible(*it2, *it1)) { - LOGN_DUMP( "found (reversed)"); + LOG_DEBUG( "found (reversed)"); editor.Connect(*it2,*it1); } else { - LOGN_DUMP( "not found"); + LOG_DEBUG( "not found"); } } } else { @@ -223,15 +223,18 @@ void HeuristicBuilder::ConnectivityFromAtomNames(const mol::ResidueHandle& res, void HeuristicBuilder::ConnectAtomsOfResidue(const mol::ResidueHandle& res) { - LOGN_DUMP("HeuristicBuilder: ConnectAtomsOfResidue on " << res.GetKey() << " " << res.GetNumber()); + LOG_DEBUG("HeuristicBuilder: ConnectAtomsOfResidue on " << res.GetKey() << " " << res.GetNumber()); mol::AtomHandleList atomlist = res.GetAtomList(); mol::AtomHandleList unk_atomlist; - LOGN_DUMP( "using atom list:"); +#if !defined(NDEBUG) + std::stringstream ss; + ss << "using atom list:"; for(mol::AtomHandleList::iterator it=atomlist.begin();it!=atomlist.end();++it) { - LOGN_DUMP( " " << it->GetName() << " @" << it->GetPos()); + ss << " " << it->GetName() << " @" << it->GetPos(); } - + LOG_DEBUG(ss.str()); +#endif std::pair<detail::ConnResEntry,bool> ret = LookupResEntry(res.GetKey()); if(ret.second) { @@ -241,11 +244,11 @@ void HeuristicBuilder::ConnectAtomsOfResidue(const mol::ResidueHandle& res) for(mol::AtomHandleList::iterator it1=unk_atomlist.begin(); it1!=unk_atomlist.end(); ++it1) { - LOGN_DUMP( "atom " << it1->GetName() << " not found, using distance based connect"); + LOG_DEBUG( "atom " << it1->GetName() << " not found, using distance based connect"); Builder::DistanceBasedConnect(*it1); } } else { - LOGN_DUMP("no residue entry found, using distance based connect"); + LOG_DEBUG("no residue entry found, using distance based connect"); for(mol::AtomHandleList::iterator it1=atomlist.begin(); it1!=atomlist.end(); ++it1) { @@ -263,16 +266,16 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0, static String fname=flag ? "HeuristicBuilder: ConnectNextXCS" : "HeuristicBuilder: ConnectPrevXCS"; if(!res0) return; // return if invalid mol::XCSEditor editor=res0.GetEntity().RequestXCSEditor(mol::BUFFERED_EDIT); - LOGN_DUMP(fname << " on " << res0.GetKey() << " " << res0.GetNumber()); + LOG_DEBUG(fname << " on " << res0.GetKey() << " " << res0.GetNumber()); if(!res1) { // auto-detect prev or next residue in chain // and perform sequence check if(flag) { - LOGN_DUMP(fname << " autodecting next residue"); + LOG_DEBUG(fname << " autodecting next residue"); res1 = res0.GetChain().GetNext(res0); } else { - LOGN_DUMP(fname << " autodecting next residue"); + LOG_DEBUG(fname << " autodecting next residue"); res1 = res0.GetChain().GetPrev(res0); } } else { @@ -285,7 +288,7 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0, } if(!res1) return; // ignore if prev/next residue is invalid - LOGN_DUMP(fname << " found second residue " << res1.GetKey() << " " << res1.GetNumber()); + LOG_DEBUG(fname << " found second residue " << res1.GetKey() << " " << res1.GetNumber()); std::pair<detail::ConnResEntry,bool> res0_ret = builder->LookupResEntry(res0.GetKey()); std::pair<detail::ConnResEntry,bool> res1_ret = builder->LookupResEntry(res1.GetKey()); @@ -297,13 +300,13 @@ void ConnectPrevNext(HeuristicBuilder* builder,mol::ResidueHandle res0, String res1_atom_name = res1_centry.GetNext(); if(res0_atom_name.empty() || res1_atom_name.empty()) return; - LOGN_DUMP(fname << ": looking up atom names " << res0_atom_name << " " << res1_atom_name); + LOG_DEBUG(fname << ": looking up atom names " << res0_atom_name << " " << res1_atom_name); // lookup both atoms in their respective residues mol::AtomHandle res0_atom = res0.FindAtom(res0_atom_name); mol::AtomHandle res1_atom = res1.FindAtom(res1_atom_name); if(res0_atom && res1_atom) { - LOGN_DUMP(fname << ": found atoms, connecting"); + LOG_DEBUG(fname << ": found atoms, connecting"); if(flag) { if (builder->DoesPeptideBondExist(res0_atom, res1_atom)) editor.Connect(res0_atom,res1_atom); @@ -374,11 +377,11 @@ void HeuristicBuilder::AssignTorsionsToResidue(const mol::ResidueHandle& res) mol::TorsionHandle th = editor.AddTorsion(tel[ti].name, ah[0], ah[1], ah[2], ah[3]); if(th) { - LOGN_DUMP("added torsion entry for " << tel[ti].a[0] << " " + LOG_DEBUG("added torsion entry for " << tel[ti].a[0] << " " << tel[ti].a[1] << " " << tel[ti].a[2] << " " << tel[ti].a[3]); } else { - LOGN_DUMP("no torsion entry for " << tel[ti].a[0] << " " + LOG_DEBUG("no torsion entry for " << tel[ti].a[0] << " " << tel[ti].a[1] << " " << tel[ti].a[2] << " " << tel[ti].a[3]); } @@ -434,15 +437,14 @@ std::pair<detail::ConnResEntry,bool> HeuristicBuilder::LookupResEntry(const mol: { static detail::ConnResEntry dummy; - LOG_DUMP("Looking for reskey '" << key << "' in connectivity map... "); + detail::ConnResEntryMap::iterator pos = emap_.find(key); if(pos!=emap_.end()) { - LOGN_DUMP("found"); + LOG_DEBUG("reskey '" << key << "' found in connectivity map"); return std::make_pair(pos->second,true); - } else { - LOGN_DUMP("not found"); } + LOG_DEBUG("reskey '" << key << "' not found connectivity map"); return std::make_pair(dummy,false); } diff --git a/modules/conop/src/heuristic_connect.cc b/modules/conop/src/heuristic_connect.cc index aaab318b2..1e20c3e44 100644 --- a/modules/conop/src/heuristic_connect.cc +++ b/modules/conop/src/heuristic_connect.cc @@ -133,7 +133,7 @@ void fill_map(ConnResEntryMap& em) for(int ec=0;ec<def_entry_count;++ec) { heuristic_connect::CONN_DEF_ENTRY& def_entry = heuristic_connect::def_entry_table[ec]; ConnResEntry entry(def_entry.abbrev); - LOG_DUMP("creating default entry for " << def_entry.abbrev << std::endl); + LOG_DEBUG("creating default entry for " << def_entry.abbrev << std::endl); // first the connectivity entries for(int cc=0;cc<def_entry.conn_count;++cc) { int conn_id[] = {def_entry.conn_list[cc][0],def_entry.conn_list[cc][1]}; @@ -160,9 +160,9 @@ void fill_map(ConnResEntryMap& em) else if(conn_nam[1]==String("-")) { entry.SetPrev(conn_nam[0]);} else if(conn_nam[0]==String("+")) { entry.SetNext(conn_nam[1]);} else if(conn_nam[1]==String("+")) { entry.SetNext(conn_nam[0]);} - LOG_DUMP(" " << conn_nam[0] << " " << conn_nam[1] << std::endl); + LOG_DEBUG(" " << conn_nam[0] << " " << conn_nam[1] << std::endl); } else { - LOG_DUMP(" " << conn_nam[0] << " " << conn_nam[1] << std::endl); + LOG_DEBUG(" " << conn_nam[0] << " " << conn_nam[1] << std::endl); entry.AddConn(conn_nam[0],conn_nam[1]); } } @@ -203,14 +203,14 @@ std::pair<ConnResEntry,bool> LookupResEntry(const ResidueKey& key) initialized=true; } - LOG_DUMP("Looking for reskey '" << key << "' in connectivity map... "); + LOG_DEBUG("Looking for reskey '" << key << "' in connectivity map... "); ConnResEntryMap::iterator pos = emap.find(key); if(pos!=emap.end()) { - LOG_DUMP("found" << std::endl); + LOG_DEBUG("found" << std::endl); return std::make_pair(pos->second,true); } else { - LOG_DUMP("not found" << std::endl); + LOG_DEBUG("not found" << std::endl); } return std::make_pair(dummy,false); } @@ -222,7 +222,7 @@ public: // visitor interface virtual bool VisitChain(const ChainHandle& chain) { - LOG_DUMP("connect: setting current chain to " << chain.GetName() << std::endl); + LOG_DEBUG("connect: setting current chain to " << chain.GetName() << std::endl); curr_chain_=chain; curr_residue_=ResidueHandle(); prev_residue_=ResidueHandle(); @@ -232,13 +232,13 @@ public: } virtual bool VisitResidue(const ResidueHandle& res) { - LOG_DUMP("connect: setting current residue to " << res.GetKey() << " " << res.GetNumber() << std::endl); + LOG_DEBUG("connect: setting current residue to " << res.GetKey() << " " << res.GetNumber() << std::endl); // residue has changed curr_residue_=res; AtomHandleList atomlist = res.GetAtomList(); - LOG_DUMP( "using atom list:" << std::endl); + LOG_DEBUG( "using atom list:" << std::endl); for(AtomHandleList::iterator it=atomlist.begin();it!=atomlist.end();++it) { - LOG_DUMP( " " << it->GetName() << " @" << it->GetPos() << std::endl); + LOG_DEBUG( " " << it->GetName() << " @" << it->GetPos() << std::endl); } std::pair<ConnResEntry,bool> ret = LookupResEntry(res.GetKey()); @@ -251,16 +251,16 @@ public: ++it2; for(;it2!=atomlist.end();++it2) { bool ex1,ex2; - LOG_DUMP( "checking for atom pair (" << it1->GetName() << "," << it2->GetName() << ") in connectivity table of " << res.GetKey() << "... "); + LOG_DEBUG( "checking for atom pair (" << it1->GetName() << "," << it2->GetName() << ") in connectivity table of " << res.GetKey() << "... "); int conn=centry.Check(it1->GetName(),it2->GetName(),ex1,ex2); if (conn==1) { - LOG_DUMP( "found" << std::endl); + LOG_DEBUG( "found" << std::endl); res.GetEntity().Connect(*it1,*it2); } else if(conn==2) { - LOG_DUMP( "found (reversed)" << std::endl); + LOG_DEBUG( "found (reversed)" << std::endl); res.GetEntity().Connect(*it2,*it1); } else { - LOG_DUMP( "not found" << std::endl); + LOG_DEBUG( "not found" << std::endl); // check ex1 and/or ex2 } } @@ -272,7 +272,7 @@ public: - previous residue number is consecutive to this one */ if(centry.GetPrev()==it1->GetName()) { // 'PREV' entry - LOG_DUMP( "found 'prev' atom entry: " << it1->GetName() << std::endl); + LOG_DEBUG( "found 'prev' atom entry: " << it1->GetName() << std::endl); if(prev_residue_) { // previous residue exists if(!next_atom_name_.empty()) { // previous residue 'NEXT' atom set if(InSequence(prev_residue_,res)) { @@ -280,7 +280,7 @@ public: for(AtomHandleList::iterator pit=prev_atomlist.begin(); pit!=prev_atomlist.end();++pit) { if(pit->GetName()==next_atom_name_) { - LOG_DUMP( "connecting previous atom " << pit->GetName() << " to " << it1->GetName() << std::endl); + LOG_DEBUG( "connecting previous atom " << pit->GetName() << " to " << it1->GetName() << std::endl); res.GetEntity().Connect(*pit,*it1); } } @@ -290,7 +290,7 @@ public: } if(centry.GetNext()==it1->GetName()) { - LOG_DUMP( "found 'next' atom entry: " << it1->GetName() << std::endl); + LOG_DEBUG( "found 'next' atom entry: " << it1->GetName() << std::endl); // remember this atom for the next residue next_atom_name_=it1->GetName(); } @@ -386,9 +386,9 @@ public: if(ah[0] && ah[1] && ah[2] && ah[3]) { TorsionHandle th = chain.GetEntity().AddTorsion(tel[ti].name,ah[0],ah[1],ah[2],ah[3]); if(th) { - LOG_DUMP("added torsion entry for " << tel[ti].a[0] << " " << tel[ti].a[1] << " " << tel[ti].a[2] << " " << tel[ti].a[3] << std::endl); + LOG_DEBUG("added torsion entry for " << tel[ti].a[0] << " " << tel[ti].a[1] << " " << tel[ti].a[2] << " " << tel[ti].a[3] << std::endl); } else { - LOG_DUMP("no torsion entry for " << tel[ti].a[0] << " " << tel[ti].a[1] << " " << tel[ti].a[2] << " " << tel[ti].a[3] << std::endl); + LOG_DEBUG("no torsion entry for " << tel[ti].a[0] << " " << tel[ti].a[1] << " " << tel[ti].a[2] << " " << tel[ti].a[3] << std::endl); } } } // ti diff --git a/modules/conop/src/sanitizer.cc b/modules/conop/src/sanitizer.cc index d7d8d4278..6f53ea8bc 100644 --- a/modules/conop/src/sanitizer.cc +++ b/modules/conop/src/sanitizer.cc @@ -37,7 +37,7 @@ bool Sanitizer::VisitResidue(const mol::ResidueHandle& residue) { this->VerifyCompleteness(residue, comp); return true; } - LOGN_ERROR("Unknown residue with name " << residue.GetName()); + LOG_ERROR("Unknown residue with name " << residue.GetName()); return false; } @@ -45,8 +45,8 @@ void Sanitizer::FillAtomProps(mol::AtomHandle atom, const AtomSpec& spec) { mol::AtomProp props=atom.GetAtomProps(); if (props.element!=spec.element) { props.element=spec.element; - LOGN_MESSAGE("Correcting element for " << atom.GetQualifiedName() << - " (now " << spec.element << ", was " << props.element << ")"); + LOG_INFO("Correcting element for " << atom.GetQualifiedName() << + " (now " << spec.element << ", was " << props.element << ")"); atom.SetAtomProps(props); } } diff --git a/modules/gfx/src/bitmap_io.cc b/modules/gfx/src/bitmap_io.cc index 8de3d7ea0..2723be73e 100644 --- a/modules/gfx/src/bitmap_io.cc +++ b/modules/gfx/src/bitmap_io.cc @@ -35,7 +35,7 @@ void export_png(const String& filename, unsigned int width, unsigned int height, FILE *fp; if((fp=fopen(filename.c_str(),"wb"))==NULL) { - LOGN_ERROR("error opening" << filename << " for exporting"); + LOG_ERROR("error opening" << filename << " for exporting"); return; } @@ -43,7 +43,7 @@ void export_png(const String& filename, unsigned int width, unsigned int height, NULL, NULL, NULL); if (png_ptr == NULL) { fclose(fp); - LOGN_ERROR("error creating png write struct"); + LOG_ERROR("error creating png write struct"); return; } @@ -51,14 +51,14 @@ void export_png(const String& filename, unsigned int width, unsigned int height, if (info_ptr == NULL) { fclose(fp); png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); - LOGN_ERROR("error creating png info struct"); + LOG_ERROR("error creating png info struct"); return; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); fclose(fp); - LOGN_ERROR("error in png setjmp"); + LOG_ERROR("error in png setjmp"); return; } @@ -107,7 +107,7 @@ Bitmap import_png(const String& filename) png_uint_32 width,height,bpp; if((fp=fopen(filename.c_str(),"rb"))==NULL) { - LOGN_ERROR("error opening " << filename); + LOG_ERROR("error opening " << filename); return bm; } @@ -115,7 +115,7 @@ Bitmap import_png(const String& filename) NULL,NULL,NULL); if (png_ptr == NULL) { fclose(fp); - LOGN_ERROR("unexpected error #1 in png lib"); + LOG_ERROR("unexpected error #1 in png lib"); return bm; } @@ -123,14 +123,14 @@ Bitmap import_png(const String& filename) if (info_ptr == NULL) { fclose(fp); png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); - LOGN_ERROR("unexpected error #2 in png lib"); + LOG_ERROR("unexpected error #2 in png lib"); return bm; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); fclose(fp); - LOGN_ERROR("unexpected error #3 in png lib"); + LOG_ERROR("unexpected error #3 in png lib"); return bm; } @@ -142,7 +142,7 @@ Bitmap import_png(const String& filename) channels=png_get_channels(png_ptr,info_ptr); if(channels<1 || channels>4) { - LOGN_ERROR("error importing bitmap: " << filename << " has " << channels << " channels, excpected 1-4"); + LOG_ERROR("error importing bitmap: " << filename << " has " << channels << " channels, excpected 1-4"); return bm; } @@ -162,7 +162,7 @@ Bitmap import_png(const String& filename) } } - LOGN_VERBOSE("loaded " << width << "x" << height << ":" << channels << " bitmap"); + LOG_DEBUG("loaded " << width << "x" << height << ":" << channels << " bitmap"); bm.channels=channels; bm.width=width; diff --git a/modules/gfx/src/entity.cc b/modules/gfx/src/entity.cc index 2da4d22f9..5bc8f4fc1 100644 --- a/modules/gfx/src/entity.cc +++ b/modules/gfx/src/entity.cc @@ -448,13 +448,13 @@ bool Entity::OnSelect(const geom::Line3& line, geom::Vec3& result, if(smode==1) { AtomView av = sel_.FindAtom(sel.GetHandle()); if(av.IsValid()) { - LOGN_DEBUG("de-selected atom: " << sel); + LOG_DEBUG("de-selected atom: " << sel); sel_.RemoveAtom(av); if(av.GetResidue().GetAtomCount()==0){ av.GetResidue().GetChain().RemoveResidue(av.GetResidue()); } } else { - LOGN_DEBUG("selected atom: " << sel); + LOG_DEBUG("selected atom: " << sel); sel_.AddAtom(sel.GetHandle()); } result = sel.GetPos(); @@ -462,10 +462,10 @@ bool Entity::OnSelect(const geom::Line3& line, geom::Vec3& result, AtomView av=sel_.FindAtom(sel); ResidueView rv=sel_.FindResidue(sel.GetResidue()); if(av.IsValid() && rv.IsValid()) { - LOGN_DEBUG("de-selected residue: " << sel.GetResidue()); + LOG_DEBUG("de-selected residue: " << sel.GetResidue()); sel_.RemoveResidue(rv); } else { - LOGN_DEBUG("selected residue: " << sel.GetResidue()); + LOG_DEBUG("selected residue: " << sel.GetResidue()); sel_.AddResidue(sel.GetResidue(),ViewAddFlag::INCLUDE_ALL); } AtomHandle ca=sel.GetHandle().GetResidue().GetCentralAtom(); @@ -477,10 +477,10 @@ bool Entity::OnSelect(const geom::Line3& line, geom::Vec3& result, ChainHandle chain=sel.GetHandle().GetResidue().GetChain(); ChainView cv = sel_.FindChain(chain); if(cv.IsValid()) { - LOGN_DEBUG("de-selected chain: " << chain); + LOG_DEBUG("de-selected chain: " << chain); sel_.RemoveChain(cv); } else { - LOGN_DEBUG("selected chain: " << chain); + LOG_DEBUG("selected chain: " << chain); sel_.AddChain(chain, ViewAddFlag::INCLUDE_ALL); } result = geom::Vec3(); // todo calculate center of mass @@ -496,7 +496,7 @@ bool Entity::OnSelect(const geom::Line3& line, geom::Vec3& result, } } if(sel) { - LOGN_MESSAGE("picked " << sel.GetResidue().GetChain().GetName() << " " + LOG_INFO("picked " << sel.GetResidue().GetChain().GetName() << " " << sel.GetResidue().GetNumber() << " " << sel.GetName()); return true; } @@ -815,7 +815,7 @@ void Entity::RadiusBy(const String& prop, it->rad=clamp(normalize(epm.Get(it->atom), minv, maxv),0.0,1.0)*(rmax-rmin)+rmin; max_rad_=std::max(max_rad_,it->rad); } catch (std::exception&) { - LOGN_DEBUG("property " << prop << " not found"); + LOG_DEBUG("property " << prop << " not found"); } } } diff --git a/modules/gfx/src/gfx_object.cc b/modules/gfx/src/gfx_object.cc index c0d24ff0e..5806328ae 100644 --- a/modules/gfx/src/gfx_object.cc +++ b/modules/gfx/src/gfx_object.cc @@ -375,11 +375,11 @@ void GfxObj::SetOutlineExpandColor(const Color& c) void GfxObj::RenderGL(RenderPass pass) { - LOGN_TRACE("object " << GetName() << ": RenderGL()"); + LOG_TRACE("object " << GetName() << ": RenderGL()"); if(pass==0) { if(mat_update_) { - LOGN_TRACE("updating material display list"); + LOG_TRACE("updating material display list"); if(mat_dlist_==0) { mat_dlist_=glGenLists(1); } @@ -396,18 +396,18 @@ void GfxObj::RenderGL(RenderPass pass) } } if(IsVisible()) { - LOGN_TRACE("applying local transformation"); + LOG_TRACE("applying local transformation"); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glMultMatrix(transform_.GetTransposedMatrix().Data()); if(Scene::Instance().InOffscreenMode()) { - LOGN_TRACE("applying material"); + LOG_TRACE("applying material"); mat_.RenderGL(); } else { - LOGN_TRACE("applying material display list"); + LOG_TRACE("applying material display list"); glCallList(mat_dlist_); } - LOGN_TRACE("calling custom render gl pass " << pass); + LOG_TRACE("calling custom render gl pass " << pass); CustomRenderGL(pass); @@ -418,7 +418,7 @@ void GfxObj::RenderGL(RenderPass pass) } if(pass==1) { - LOGN_TRACE("drawing labels"); + LOG_TRACE("drawing labels"); render_labels(); } @@ -440,7 +440,7 @@ void GfxObj::RenderPov(PovState& pov) void GfxObj::PreRenderGL(bool f) { - LOGN_DUMP("object " << GetName() << ": PreRenderGL()"); + LOG_DEBUG("object " << GetName() << ": PreRenderGL()"); CustomPreRenderGL(f); } @@ -621,8 +621,9 @@ void GfxObj::AmbientOcclusion(bool f) void GfxObj::ColorBy(const mol::EntityView& ev, const String& prop, const Gradient& g, float minv, float maxv) -{ - LOGN_VERBOSE("ColorBy not implemented for this gfx object"); +{ + // FIXME: Throw exception here... + LOG_ERROR("ColorBy not implemented for this gfx object"); } @@ -641,7 +642,8 @@ void GfxObj::ColorBy(const img::MapHandle& mh, const String& prop, const Gradient& g, float minv, float maxv) { - LOGN_VERBOSE("ColorBy not implemented for this gfx object"); + // FIXME: Throw exception here + LOG_ERROR("ColorBy not implemented for this gfx object"); } void GfxObj::ColorBy(const img::MapHandle& mh, diff --git a/modules/gfx/src/gfx_test_object.cc b/modules/gfx/src/gfx_test_object.cc index 7baead968..6e6cb3ae4 100644 --- a/modules/gfx/src/gfx_test_object.cc +++ b/modules/gfx/src/gfx_test_object.cc @@ -61,9 +61,9 @@ GfxTestObj::GfxTestObj(): bf::path tex_file(ost_root_dir / "textures/test_texture.png"); Bitmap bm = BitmapImport(tex_file.string(),".png"); if(!bm.data) { - LOGN_ERROR("error loading " << tex_file.string()); + LOG_ERROR("error loading " << tex_file.string()); } else { - LOGN_VERBOSE("importing tex with id " << tex_id); + LOG_DEBUG("importing tex with id " << tex_id); glBindTexture(GL_TEXTURE_2D, tex_id); glPixelStorei(GL_UNPACK_ALIGNMENT,1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); diff --git a/modules/gfx/src/impl/calc_ambient.cc b/modules/gfx/src/impl/calc_ambient.cc index cfbbdacc1..82d9ecd62 100644 --- a/modules/gfx/src/impl/calc_ambient.cc +++ b/modules/gfx/src/impl/calc_ambient.cc @@ -353,8 +353,8 @@ namespace { void ost::gfx::CalcAmbientTerms(IndexedVertexArray& va) { AmbientOcclusionBuilder aob(va); - LOGN_VERBOSE("building component map"); + LOG_DEBUG("building component map"); aob.build_cmap(); - LOGN_VERBOSE("calculating ambient terms"); + LOG_DEBUG("calculating ambient terms"); aob.calc_all(); } diff --git a/modules/gfx/src/impl/cgl_offscreen_buffer.cc b/modules/gfx/src/impl/cgl_offscreen_buffer.cc index 2fc1cd9d1..ea5e3599b 100644 --- a/modules/gfx/src/impl/cgl_offscreen_buffer.cc +++ b/modules/gfx/src/impl/cgl_offscreen_buffer.cc @@ -42,7 +42,7 @@ OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, GLint npix=0; CGLError err=CGLChoosePixelFormat(attributes, &pix_format_, &npix); if(err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLChoosePixFormat failed:" << CGLErrorString(err)); return; } @@ -54,14 +54,14 @@ OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, err=CGLCreateContext(pix_format_, NULL, &context_); } if(err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLCreateContext failed" << CGLErrorString(err)); return; } err=CGLCreatePBuffer(width, height, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, 0, &pbuffer_); if (err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLCreatePBuffer failed: " << CGLErrorString(err)); return; } @@ -69,7 +69,7 @@ OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, assert(CGLGetVirtualScreen(context_, &screen)==0); err=CGLSetPBuffer(context_, pbuffer_, 0, 0, screen); if (err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLSetPBuffer failed: " << CGLErrorString(err)); return; } @@ -83,7 +83,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) CGLError err=CGLCreatePBuffer(width, height, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, 0, &new_pbuffer); if (err) { - LOGN_ERROR("error resizing offscreen rendering context: " + LOG_ERROR("error resizing offscreen rendering context: " "CGLCreatePBuffer failed: " << CGLErrorString(err)); return false; } @@ -95,7 +95,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) err=CGLSetPBuffer(context_, new_pbuffer, 0, 0, screen); if (err) { - LOGN_ERROR("error resizing offscreen rendering context. " + LOG_ERROR("error resizing offscreen rendering context. " "CGLSetPBuffer failed: " << CGLErrorString(err)); return false; } @@ -112,7 +112,7 @@ bool OffscreenBuffer::MakeActive() if(active_) return true; if (CGLError err=CGLSetCurrentContext(context_)) { - LOGN_ERROR("error switching to offscreen rendering context. " + LOG_ERROR("error switching to offscreen rendering context. " "CGLSetCurrentContext failed: " << CGLErrorString(err)); return false; } diff --git a/modules/gfx/src/impl/entity_renderer.hh b/modules/gfx/src/impl/entity_renderer.hh index b3e47c012..ba54403ef 100644 --- a/modules/gfx/src/impl/entity_renderer.hh +++ b/modules/gfx/src/impl/entity_renderer.hh @@ -214,7 +214,7 @@ struct GradientLevelGetCol { float n=Normalize(epm_.Get(atom, minv_), minv_, maxv_); return gradient_.GetColorAt(n); }catch(std::exception&){ - LOGN_DEBUG("property " << property_ << " not found"); + LOG_DEBUG("property " << property_ << " not found"); return Color(); } } diff --git a/modules/gfx/src/impl/glx_offscreen_buffer.cc b/modules/gfx/src/impl/glx_offscreen_buffer.cc index fc1e2b0e9..095666765 100644 --- a/modules/gfx/src/impl/glx_offscreen_buffer.cc +++ b/modules/gfx/src/impl/glx_offscreen_buffer.cc @@ -30,16 +30,16 @@ namespace ost { namespace gfx { OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared): width_(width), height_(height), valid_(false), active_(false) { - LOGN_DEBUG("offscreen buffer: checking for DISPLAY"); + LOG_DEBUG("offscreen buffer: checking for DISPLAY"); if(getenv("DISPLAY")==NULL) { - LOGN_ERROR("error creating offscreen rendering context: missing DISPLAY environment variable"); + LOG_ERROR("error creating offscreen rendering context: missing DISPLAY environment variable"); return; } - LOGN_DEBUG("offscreen buffer: XOpenDisplay"); + LOG_DEBUG("offscreen buffer: XOpenDisplay"); dpy_ = XOpenDisplay(getenv("DISPLAY")); if(dpy_==NULL) { - LOGN_ERROR("error creating offscreen rendering context: XOpenDisplay failed"); + LOG_ERROR("error creating offscreen rendering context: XOpenDisplay failed"); return; } @@ -63,10 +63,10 @@ OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, const attrib_list.push_back(0); int nelem=0; - LOGN_DEBUG("offscreen buffer: glXChooseFBConfig"); + LOG_DEBUG("offscreen buffer: glXChooseFBConfig"); fbconfig_ =glXChooseFBConfig(dpy_,0,&attrib_list[0],&nelem); if(fbconfig_==0 || nelem==0) { - LOGN_ERROR("error creating offscreen rendering context: glXChooseFBConfig failed"); + LOG_ERROR("error creating offscreen rendering context: glXChooseFBConfig failed"); return; } @@ -77,26 +77,26 @@ OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, const attrib_list.push_back(height_); attrib_list.push_back(0); - LOGN_DEBUG("offscreen buffer: glXCreatePBuffer"); + LOG_DEBUG("offscreen buffer: glXCreatePBuffer"); pbuffer_ = glXCreatePbuffer(dpy_, fbconfig_[0], &attrib_list[0]); if(!pbuffer_) { - LOGN_ERROR("error creating offscreen rendering context: glXCreatePBuffer failed"); + LOG_ERROR("error creating offscreen rendering context: glXCreatePBuffer failed"); return; } if(shared) { - LOGN_DEBUG("offscreen buffer: glxCreateNewContext(shared=true)"); + LOG_DEBUG("offscreen buffer: glxCreateNewContext(shared=true)"); context_ = glXCreateNewContext(dpy_, fbconfig_[0], GLX_RGBA_TYPE, glXGetCurrentContext(), True); } else { - LOGN_DEBUG("offscreen buffer: glxCreateNewContext(shared=false)"); + LOG_DEBUG("offscreen buffer: glxCreateNewContext(shared=false)"); context_ = glXCreateNewContext(dpy_, fbconfig_[0], GLX_RGBA_TYPE, NULL, True); } if(!context_) { - LOGN_ERROR("error creating offscreen rendering context: glXCreateNewContext failed"); + LOG_ERROR("error creating offscreen rendering context: glXCreateNewContext failed"); glXDestroyPbuffer(dpy_, pbuffer_); return; } @@ -124,7 +124,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) GLXPbuffer new_pbuffer = glXCreatePbuffer(dpy_, fbconfig_[0], &attrib_list[0]); if(!new_pbuffer) { - LOGN_ERROR("offscreen rendering resize failed to allocate new pbuffer"); + LOG_ERROR("offscreen rendering resize failed to allocate new pbuffer"); return false; } @@ -132,7 +132,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) glXGetCurrentContext(), True); if(!new_context) { - LOGN_ERROR("offscreen rendering resize failed to get new context"); + LOG_ERROR("offscreen rendering resize failed to get new context"); return false; } @@ -153,7 +153,7 @@ bool OffscreenBuffer::MakeActive() if(active_) return true; if(!glXMakeContextCurrent(dpy_, pbuffer_, pbuffer_, context_)) { - LOGN_ERROR("error switching to offscreen rendering context: glXMakeContextCurrent failed"); + LOG_ERROR("error switching to offscreen rendering context: glXMakeContextCurrent failed"); return false; } return true; diff --git a/modules/gfx/src/impl/map_iso_gen.cc b/modules/gfx/src/impl/map_iso_gen.cc index 06e5fd1e6..d02ec1c4e 100644 --- a/modules/gfx/src/impl/map_iso_gen.cc +++ b/modules/gfx/src/impl/map_iso_gen.cc @@ -189,10 +189,9 @@ void IsosurfaceGenerator::Generate(const img::MapHandle& mh, IndexedVertexArray& if(static_cast<float>(rsis->Value(img::Point(us,vs+1,ws+1)))<level) pattern|=1<<5; if(static_cast<float>(rsis->Value(img::Point(us+1,vs+1,ws+1)))<level) pattern|=1<<6; if(static_cast<float>(rsis->Value(img::Point(us+1,vs,ws+1)))<level) pattern|=1<<7; - String msg; - std::stringstream msgs(msg); - msgs << u << " " << v << " " << w << ": " << pattern << " " << mh.GetReal(img::Point(u,v,w)) << std::endl; - LOG_VERBOSE(msgs); + + LOG_TRACE(u << " " << v << " " << w << ": " << pattern << " " + << mh.GetReal(img::Point(u,v,w))); /* set up already known vertex-ids from book keeping diff --git a/modules/gfx/src/map_iso.cc b/modules/gfx/src/map_iso.cc index 946c2becb..1a9694663 100644 --- a/modules/gfx/src/map_iso.cc +++ b/modules/gfx/src/map_iso.cc @@ -450,7 +450,7 @@ img::ImageHandle MapIso::DownsampleMap(const img::ImageHandle& mh) uint downsampling_fact = compute_downsampling_fact(mh); img:: ImageHandle ret_mh = mh; if (downsampling_fact != 1) { - LOG_MESSAGE("Downsampling map for more comfortable visualization") + LOG_INFO("Downsampling map for more comfortable visualization") img::alg::DiscreteShrink shrink_alg(img::Size(downsampling_fact,downsampling_fact,downsampling_fact)); ret_mh = mh.Apply(shrink_alg); } diff --git a/modules/gfx/src/offscreen_buffer.cc b/modules/gfx/src/offscreen_buffer.cc index 278c77bb1..b7b187928 100644 --- a/modules/gfx/src/offscreen_buffer.cc +++ b/modules/gfx/src/offscreen_buffer.cc @@ -38,7 +38,7 @@ OffscreenBuffer& OffscreenBuffer::Instance() bool OffscreenBuffer::Begin() { - LOGN_DEBUG("switching to offscreen rendering"); + LOG_DEBUG("switching to offscreen rendering"); if(active_) return true; @@ -52,7 +52,7 @@ bool OffscreenBuffer::Begin() old_dr2_ = glXGetCurrentReadDrawable(); if(!glXMakeContextCurrent(dpy_, pbuffer_, pbuffer_, context_)) { - LOGN_ERROR("error switching to offscreen rendering context: glXMakeContextCurrent failed"); + LOG_ERROR("error switching to offscreen rendering context: glXMakeContextCurrent failed"); return false; } } @@ -62,7 +62,7 @@ bool OffscreenBuffer::Begin() if(context_ != old_context_) { if (CGLError err=CGLSetCurrentContext(context_)) { - LOGN_ERROR("error switching to offscreen rendering context. " + LOG_ERROR("error switching to offscreen rendering context. " "CGLSetCurrentContext failed: " << CGLErrorString(err)); return false; } @@ -73,7 +73,7 @@ bool OffscreenBuffer::Begin() if(context_ != old_context_) { dev_context_=wglGetCurrentDC(); if (BOOL err=wglMakeCurrent(dev_context_, context_)) { - LOGN_ERROR("error switching to offscreen rendering context. " + LOG_ERROR("error switching to offscreen rendering context. " "wglMakeCurrent failed: "); return false; } @@ -86,7 +86,7 @@ bool OffscreenBuffer::Begin() bool OffscreenBuffer::End() { - LOGN_DEBUG("switching back to normal rendering"); + LOG_DEBUG("switching back to normal rendering"); if(!active_) return true; @@ -132,7 +132,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) GLXPbuffer new_pbuffer = glXCreatePbuffer(dpy_, fbconfig_[0], &attrib_list[0]); if(!new_pbuffer) { - LOGN_ERROR("offscreen rendering resize failed"); + LOG_ERROR("offscreen rendering resize failed"); return false; } @@ -140,7 +140,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) glXGetCurrentContext(), True); if(!new_context) { - LOGN_ERROR("offscreen rendering resize failed to get new context"); + LOG_ERROR("offscreen rendering resize failed to get new context"); return false; } @@ -155,7 +155,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) CGLError err=CGLCreatePBuffer(width, height, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, 0, &new_pbuffer); if (err) { - LOGN_ERROR("error resizing offscreen rendering context: " + LOG_ERROR("error resizing offscreen rendering context: " "CGLCreatePBuffer failed: " << CGLErrorString(err)); return false; } @@ -163,7 +163,7 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) assert(CGLGetVirtualScreen(context_, &screen)==0); err=CGLSetPBuffer(context_, new_pbuffer, 0, 0, screen); if (err) { - LOGN_ERROR("error resizing offscreen rendering context. " + LOG_ERROR("error resizing offscreen rendering context. " "CGLSetPBuffer failed: " << CGLErrorString(err)); return false; } @@ -178,27 +178,27 @@ bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) new_pbuffer = wglCreatePbufferARB(dev_context_, format, width, height, attribList); if (new_pbuffer == NULL) { - LOGN_ERROR("Error resizing offscreen rendering context (wglCreatePbufferARB failed)\n"); + LOG_ERROR("Error resizing offscreen rendering context (wglCreatePbufferARB failed)\n"); return false; } dev_context_ = wglGetPbufferDCARB(new_pbuffer); if (dev_context_ == NULL) { - LOGN_ERROR("Unable to retrieve handle to resized pbuffer device context\n"); + LOG_ERROR("Unable to retrieve handle to resized pbuffer device context\n"); return false; } context_ = wglCreateContext(dev_context_); if (context_ == NULL) { - LOGN_ERROR("Unable to create a rendering context for the resized pbuffer\n"); + LOG_ERROR("Unable to create a rendering context for the resized pbuffer\n"); return false; } // //if (!wglShareLists(old_context_, context_)) //{ - // LOGN_ERROR("Unable to share data between resized rendering contexts\n"); + // LOG_ERROR("Unable to share data between resized rendering contexts\n"); // return; //} */ @@ -228,12 +228,12 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, #if defined(__linux__) if(getenv("DISPLAY")==NULL) { - LOGN_ERROR("error creating offscreen rendering context: missing DISPLAY environment variable"); + LOG_ERROR("error creating offscreen rendering context: missing DISPLAY environment variable"); return; } dpy_ = XOpenDisplay(getenv("DISPLAY")); if(dpy_==NULL) { - LOGN_ERROR("error creating offscreen rendering context: XOpenDisplay failed"); + LOG_ERROR("error creating offscreen rendering context: XOpenDisplay failed"); return; } @@ -259,7 +259,7 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, int nelem=0; fbconfig_ =glXChooseFBConfig(dpy_,0,&attrib_list[0],&nelem); if(fbconfig_==0 || nelem==0) { - LOGN_ERROR("error creating offscreen rendering context: glXChooseFBConfig failed"); + LOG_ERROR("error creating offscreen rendering context: glXChooseFBConfig failed"); return; } @@ -272,14 +272,14 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, pbuffer_ = glXCreatePbuffer(dpy_, fbconfig_[0], &attrib_list[0]); if(!pbuffer_) { - LOGN_ERROR("error creating offscreen rendering context: glXCreatePBuffer failed"); + LOG_ERROR("error creating offscreen rendering context: glXCreatePBuffer failed"); return; } context_ = glXCreateNewContext(dpy_, fbconfig_[0], GLX_RGBA_TYPE, glXGetCurrentContext(), True); if(!context_) { - LOGN_ERROR("error creating offscreen rendering context: glXCreateNewContext failed"); + LOG_ERROR("error creating offscreen rendering context: glXCreateNewContext failed"); return; } @@ -294,7 +294,7 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, GLint npix=0; CGLError err=CGLChoosePixelFormat(attributes, &pix_format_, &npix); if(err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLChoosePixFormat failed:" << CGLErrorString(err)); return; } @@ -302,14 +302,14 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, // lists. err=CGLCreateContext(pix_format_, CGLGetCurrentContext(), &context_); if(err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLCreateContext failed" << CGLErrorString(err)); return; } err=CGLCreatePBuffer(width, height, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, 0, &pbuffer_); if (err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLCreatePBuffer failed: " << CGLErrorString(err)); return; } @@ -317,7 +317,7 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, assert(CGLGetVirtualScreen(context_, &screen)==0); err=CGLSetPBuffer(context_, pbuffer_, 0, 0, screen); if (err) { - LOGN_ERROR("error creating offscreen rendering context. " + LOG_ERROR("error creating offscreen rendering context. " "CGLSetPBuffer failed: " << CGLErrorString(err)); return; } @@ -346,7 +346,7 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, wglChoosePixelFormatARB(dev_context_, attribList, NULL, 1, &format, &nformats); if (nformats == 0) { - LOGN_ERROR("Unable to find any RGBA32 floating point pixel formats\n"); + LOG_ERROR("Unable to find any RGBA32 floating point pixel formats\n"); return; } @@ -366,27 +366,27 @@ OffscreenBuffer::OffscreenBuffer(int width, int height, int r_bits, pbuffer_ = wglCreatePbufferARB(dev_context_, format, width, height, attribs); if (pbuffer_ == NULL) { - LOGN_ERROR("Unable to create floating point pbuffer (wglCreatePbufferARB failed)\n"); + LOG_ERROR("Unable to create floating point pbuffer (wglCreatePbufferARB failed)\n"); return; } old_dev_context_ = wglGetPbufferDCARB(pbuffer_); if (dev_context_ == NULL) { - LOGN_ERROR("Unable to retrieve handle to pbuffer device context\n"); + LOG_ERROR("Unable to retrieve handle to pbuffer device context\n"); return; } context_ = wglCreateContext(dev_context_); if (context_ == NULL) { - LOGN_ERROR("Unable to create a rendering context for the pbuffer\n"); + LOG_ERROR("Unable to create a rendering context for the pbuffer\n"); return; } if (!wglShareLists(old_context_, context_)) { - LOGN_ERROR("Unable to share data between rendering contexts\n"); + LOG_ERROR("Unable to share data between rendering contexts\n"); return; } */ diff --git a/modules/gfx/src/scene.cc b/modules/gfx/src/scene.cc index 7afa52997..8f781aaf9 100644 --- a/modules/gfx/src/scene.cc +++ b/modules/gfx/src/scene.cc @@ -181,7 +181,7 @@ void set_light_dir(Vec3 ld) void Scene::InitGL() { - LOG_DEBUG("scene: initializing GL state" << std::endl); + LOG_DEBUG("scene: initializing GL state"); #if OST_SHADER_SUPPORT_ENABLED Shader::Instance().PreGLInit(); @@ -462,13 +462,13 @@ void Scene::RenderGL() void Scene::Register(GLWinBase* win) { - LOG_DEBUG("scene: registered win @" << win << std::endl); + LOG_DEBUG("scene: registered win @" << win); win_=win; } void Scene::Unregister(GLWinBase* win) { - LOG_DEBUG("scene: unregistered win @" << win << std::endl); + LOG_DEBUG("scene: unregistered win @" << win); win_=0; } @@ -539,7 +539,7 @@ void Scene::Add(const GfxNodeP& n, bool redraw) throw Error("Scene already has a node with name '"+n->GetName()+"'"); } - LOG_DEBUG("scene: graphical object added @" << n.get() << std::endl); + LOG_DEBUG("scene: graphical object added @" << n.get()); root_node_->Add(n); if (redraw) { this->RequestRedraw(); @@ -551,7 +551,7 @@ bool Scene::IsNameAvailable(String name) FindNode fn(name); Apply(fn); if(fn.node) { - LOGN_MESSAGE(name << " already exists as a scene node"); + LOG_INFO(name << " already exists as a scene node"); return false; } return true; @@ -641,12 +641,12 @@ GfxObjP Scene::operator[](const String& name) FindNode fn(name); Apply(fn); if(!fn.node) { - LOGN_ERROR("error: " << name << " not found"); + LOG_ERROR("error: " << name << " not found"); return GfxObjP(); } GfxObjP nrvo = dyn_cast<GfxObj>(fn.node); if(!nrvo) { - LOGN_ERROR("error: " << name << " points to invalid entry"); + LOG_ERROR("error: " << name << " points to invalid entry"); } return nrvo; } @@ -660,7 +660,8 @@ bool Scene::HasNode(const String& name) const void Scene::Apply(const InputEvent& e, bool request_redraw) { - LOG_TRACE("Scene: received input: c=" << e.GetCommand() << " i=" << e.GetIndex() << " t=" << e.GetTarget() << std::endl); + LOG_TRACE("Scene: received input: c=" << e.GetCommand() + << " i=" << e.GetIndex() << " t=" << e.GetTarget()); /* TODO distribute event to transform that @@ -763,7 +764,7 @@ void Scene::Pick(int mx, int my, int mask) Vec3 v1=UnProject(Vec3(mx,my,0.0)); Vec3 v2=UnProject(Vec3(mx,my,1.0)); - LOG_DUMP("Scene pick: " << v1 << " " << v2 << " " << mask << std::endl); + LOG_DEBUG("Scene pick: " << v1 << " " << v2 << " " << mask); Scene::Instance().StatusMessage(""); @@ -1139,13 +1140,13 @@ struct OffscreenSwitcher { OffscreenSwitcher() { - LOGN_TRACE("offscreen begin"); + LOG_TRACE("offscreen begin"); OffscreenBuffer::Instance().Begin(); } ~OffscreenSwitcher() { - LOGN_TRACE("offscreen end"); + LOG_TRACE("offscreen end"); OffscreenBuffer::Instance().End(); } }; @@ -1157,17 +1158,17 @@ void Scene::Export(const String& fname, unsigned int width, { int d_index=fname.rfind('.'); if (d_index==-1) { - LOGN_ERROR("no file extension specified"); + LOG_ERROR("no file extension specified"); return; } String ext = fname.substr(d_index); if(!(ext==".png")) { - LOGN_ERROR("unknown file format (" << ext << ")"); + LOG_ERROR("unknown file format (" << ext << ")"); return; } offscreen_flag_=true; - LOGN_TRACE("offscreen resize"); + LOG_TRACE("offscreen resize"); OffscreenBuffer::Instance().Resize(width, height); try { // ensures that context is switched back when this goes out of scope @@ -1176,27 +1177,27 @@ void Scene::Export(const String& fname, unsigned int width, #if OST_SHADER_SUPPORT_ENABLED String shader_name = Shader::Instance().GetCurrentName(); #endif - LOGN_TRACE("initializing GL"); + LOG_TRACE("initializing GL"); this->InitGL(); - LOGN_TRACE("setting viewport"); + LOG_TRACE("setting viewport"); SetViewport(width,height); - LOGN_TRACE("reseting projection"); + LOG_TRACE("reseting projection"); ResetProjection(); - LOGN_TRACE("updating fog settings"); + LOG_TRACE("updating fog settings"); update_fog(); glDrawBuffer(GL_FRONT); //this->flag_all_dirty(); #if OST_SHADER_SUPPORT_ENABLED - LOGN_TRACE("activating shader"); + LOG_TRACE("activating shader"); Shader::Instance().Activate(shader_name); #endif - LOGN_TRACE("doing rendering"); + LOG_TRACE("doing rendering"); this->RenderGL(); // make sure drawing operations are finished glFinish(); boost::shared_array<uchar> img_data(new uchar[width*height*4]); - LOGN_TRACE("setting background transparency"); + LOG_TRACE("setting background transparency"); if (transparent) { glPixelTransferf(GL_ALPHA_BIAS, 0.0); } else { @@ -1204,18 +1205,18 @@ void Scene::Export(const String& fname, unsigned int width, glPixelTransferf(GL_ALPHA_BIAS, 1.0); } - LOGN_TRACE("reading framebuffer pixels"); + LOG_TRACE("reading framebuffer pixels"); glReadBuffer(GL_FRONT); glReadPixels(0,0,width,height,GL_RGBA,GL_UNSIGNED_BYTE,img_data.get()); - LOGN_DEBUG("calling bitmap export"); + LOG_DEBUG("calling bitmap export"); BitmapExport(fname,ext,width,height,img_data.get()); } catch (...) { // noop } // offscreen_switch goes out of scope offscreen_flag_=false; glDrawBuffer(GL_BACK); - LOGN_TRACE("updating fog"); + LOG_TRACE("updating fog"); update_fog(); } @@ -1223,12 +1224,12 @@ void Scene::Export(const String& fname, bool transparent) { int d_index=fname.rfind('.'); if (d_index==-1) { - LOGN_ERROR("no file extension specified"); + LOG_ERROR("no file extension specified"); return; } String ext = fname.substr(d_index); if(ext!=".png") { - LOGN_ERROR("unknown file format (" << ext << ")"); + LOG_ERROR("unknown file format (" << ext << ")"); return; } GLint vp[4]; @@ -1268,7 +1269,7 @@ void Scene::ExportPov(const std::string& fname, const std::string& wdir) void Scene::ResetProjection() { - LOGN_TRACE("scene: projection matrix " << fov_ << " " << znear_ << " " << zfar_); + LOG_TRACE("scene: projection matrix " << fov_ << " " << znear_ << " " << zfar_); stereo_projection(stereo_eye_); } @@ -1603,7 +1604,7 @@ void Scene::prep_glyphs() Bitmap bm = BitmapImport(tex_file.string(),".png"); if(!bm.data) return; - LOGN_DEBUG("importing glyph tex with id " << glyph_tex_id_); + LOG_DEBUG("importing glyph tex with id " << glyph_tex_id_); glBindTexture(GL_TEXTURE_2D, glyph_tex_id_); glPixelStorei(GL_UNPACK_ALIGNMENT,1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); @@ -1617,7 +1618,7 @@ void Scene::prep_glyphs() } else if(bm.channels==4) { glTexImage2D(GL_TEXTURE_2D,0,GL_INTENSITY,bm.width,bm.height,0,GL_RGBA,GL_UNSIGNED_BYTE,bm.data.get()); } else { - LOGN_ERROR("unsupported glyph texture channel count of " << bm.channels); + LOG_ERROR("unsupported glyph texture channel count of " << bm.channels); return; } float ir = 1.0/8.0; @@ -1631,7 +1632,7 @@ void Scene::prep_glyphs() } for(int cc=128;cc<256;++cc) glyph_map_[cc]=Vec2(0.0,0.0); - LOGN_VERBOSE("done loading glyphs"); + LOG_VERBOSE("done loading glyphs"); } diff --git a/modules/gfx/src/shader.cc b/modules/gfx/src/shader.cc index e7d1cd5b7..96f4256c8 100644 --- a/modules/gfx/src/shader.cc +++ b/modules/gfx/src/shader.cc @@ -57,7 +57,7 @@ void Shader::PreGLInit() #if !defined(__APPLE__) GLenum err = glewInit(); if (GLEW_OK != err) { - LOGN_ERROR("glew failure: " << glewGetErrorString(err)); + LOG_ERROR("glew failure: " << glewGetErrorString(err)); assert(false); } #endif @@ -76,13 +76,13 @@ bool compile_shader(String shader_name, String shader_code, GLenum shader_type, GLint sh_compiled; glGetShaderiv(shader_id, GL_COMPILE_STATUS, &sh_compiled); if(sh_compiled==GL_TRUE) { - LOGN_VERBOSE("shader [" << shader_name << "] successfully compiled (" << shader_id << ")"); + LOG_ERROR("shader [" << shader_name << "] successfully compiled (" << shader_id << ")"); } else { GLint sh_log_length; glGetShaderiv(shader_id, GL_INFO_LOG_LENGTH, &sh_log_length); std::vector<GLchar> sh_log(sh_log_length+1); glGetShaderInfoLog(shader_id, sh_log_length, NULL, &sh_log[0]); - LOGN_VERBOSE("shader [" << shader_name << "] compilation failed:" << std::endl << String(&sh_log[0])); + LOG_ERROR("shader [" << shader_name << "] compilation failed:" << std::endl << String(&sh_log[0])); return false; } return true; @@ -93,10 +93,10 @@ bool link_shader(const std::vector<GLuint>& code_list, String pr_name, GLuint& s shader_pr = glCreateProgram(); for(std::vector<GLuint>::const_iterator it=code_list.begin();it!=code_list.end();++it) { if(*it == 0) { - LOGN_VERBOSE("skipping shader [" << pr_name << "] due to missing compiled code"); + LOG_WARNING("skipping shader [" << pr_name << "] due to missing compiled code"); return false; } - LOGN_DEBUG("attaching compiled shader id " << *it << " to " << shader_pr); + LOG_INFO("attaching compiled shader id " << *it << " to " << shader_pr); glAttachShader(shader_pr,*it); } @@ -104,13 +104,13 @@ bool link_shader(const std::vector<GLuint>& code_list, String pr_name, GLuint& s GLint pr_linked; glGetProgramiv(shader_pr,GL_LINK_STATUS,&pr_linked); if(pr_linked==GL_TRUE) { - LOGN_VERBOSE("shader [" << pr_name << "] sucessfully linked"); + LOG_INFO("shader [" << pr_name << "] sucessfully linked"); } else { GLint pr_log_length; glGetProgramiv(shader_pr, GL_INFO_LOG_LENGTH, &pr_log_length); std::vector<GLchar> pr_log(pr_log_length+1); glGetProgramInfoLog(shader_pr, pr_log_length, NULL, &pr_log[0]); - LOGN_VERBOSE("shader [" << pr_name << "] linking failed:" << std::endl << String(&pr_log[0])); + LOG_ERROR("shader [" << pr_name << "] linking failed:" << std::endl << String(&pr_log[0])); return false; } return true; @@ -162,7 +162,7 @@ void Shader::Setup() bf::path shader_file(shader_dir / shader_name); if(!bf::exists(shader_file)){ - LOGN_ERROR("not found: [" << shader_file.string() << "], cannot create shaders"); + LOG_ERROR("not found: [" << shader_file.string() << "], cannot create shaders"); continue; } @@ -275,7 +275,7 @@ void Shader::Activate(const String& name) if(!name.empty()) { std::map<String, GLuint>::iterator it = shader_program_map_.find(name); if(it!=shader_program_map_.end()) { - LOGN_DUMP("switching to shader [" << name << "]"); + LOG_DEBUG("switching to shader [" << name << "]"); glUseProgram(it->second); current_program_=it->second; current_name_=name; @@ -292,11 +292,11 @@ void Shader::Activate(const String& name) return; } else { - LOGN_MESSAGE("shader program [" << name << "] not present"); + LOG_INFO("shader program [" << name << "] not present"); return; } } - LOGN_DUMP("switching to fixed pipeline"); + LOG_DEBUG("switching to fixed pipeline"); glUseProgram(0); current_program_=0; current_name_=""; @@ -342,14 +342,14 @@ void Shader::UpdateState() // update current lighting and fog settings, valid for all shaders GLint result; glGetIntegerv(GL_LIGHTING,&result); - LOGN_TRACE("setting lighting flag to " << result); + LOG_TRACE("setting lighting flag to " << result); glUniform1i(glGetUniformLocation(current_program_,"lighting_flag"),result); GLboolean bresult; glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE,&bresult); - LOGN_TRACE("setting two_sided flag to " << bresult); + LOG_TRACE("setting two_sided flag to " << bresult); glUniform1i(glGetUniformLocation(current_program_,"two_sided_flag"),bresult); glGetIntegerv(GL_FOG,&result); - LOGN_TRACE("setting fog flag to " << result); + LOG_TRACE("setting fog flag to " << result); glUniform1i(glGetUniformLocation(current_program_,"fog_flag"),result); glDisable(GL_COLOR_MATERIAL); } else { diff --git a/modules/gfx/src/vertex_array.cc b/modules/gfx/src/vertex_array.cc index 970c09887..484d153a7 100644 --- a/modules/gfx/src/vertex_array.cc +++ b/modules/gfx/src/vertex_array.cc @@ -40,7 +40,7 @@ #define VERTEX_ARRAY_CHECK_GL_ERROR(m) \ if((glerr=glGetError())!=0) { \ - LOGN_VERBOSE("Error during va buffer prep: " << m << " : " << gluErrorString(glerr)); \ + LOG_ERROR("Error during va buffer prep: " << m << " : " << gluErrorString(glerr)); \ return false; \ } @@ -155,7 +155,7 @@ unsigned int IndexedVertexArray::GetVertexCount() const void IndexedVertexArray::DumpVertices() const { for(uint i=0;i<entry_list_.size();++i) { - LOGN_MESSAGE("id=" << i << " v=" << entry_list_[i].v << " n=" << entry_list_[i].n << " c=" << entry_list_[i].c); + LOG_INFO("id=" << i << " v=" << entry_list_[i].v << " n=" << entry_list_[i].n << " c=" << entry_list_[i].c); } } @@ -345,7 +345,7 @@ void IndexedVertexArray::RenderGL() static bool use_buff=false; if(!initialized_) { - LOGN_DUMP("initializing vertex array lists"); + LOG_DEBUG("initializing vertex array lists"); #if OST_SHADER_SUPPORT_ENABLED glGenBuffers(7,buffer_id_); #endif @@ -357,12 +357,12 @@ void IndexedVertexArray::RenderGL() dirty_=false; #if OST_SHADER_SUPPORT_ENABLED if(ambient_dirty_ && use_ambient_) { - LOGN_DUMP("re-calculating ambient occlusion terms"); + LOG_DEBUG("re-calculating ambient occlusion terms"); recalc_ambient_occlusion(); ambient_dirty_=false; } - LOGN_DUMP("checking buffer object availability"); + LOG_DEBUG("checking buffer object availability"); if(mode_&0x2 && aalines_flag_) { use_buff=false; } else { @@ -372,7 +372,7 @@ void IndexedVertexArray::RenderGL() glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); } else { - LOGN_DUMP("using buffer objects for vertex array"); + LOG_DEBUG("using buffer objects for vertex array"); } #endif } @@ -382,7 +382,7 @@ void IndexedVertexArray::RenderGL() glPushMatrix(); if(outline_mode_>0) { - LOGN_TRACE("outline rendering"); + LOG_TRACE("outline rendering"); if(outline_mat_update_) { glNewList(outline_mat_dlist_,GL_COMPILE); outline_mat_.RenderGL(); @@ -694,7 +694,7 @@ void IndexedVertexArray::CalcNormals(float smoothf) void IndexedVertexArray::CalcFullNormals() { - LOGN_DUMP("calculating normals for vertex array"); + LOG_DEBUG("calculating normals for vertex array"); // book keeping setup static NormalizerTriEntry nte={0,0,0,0,Vec3(),1.0}; @@ -752,7 +752,7 @@ void IndexedVertexArray::CalcFullNormals() norm+=nte.norm*nte.weight; //norm+=nte.norm*nve.weight; } else { - LOGN_DUMP("faulty vertex lookup in VA Normalize"); + LOG_DEBUG("faulty vertex lookup in VA Normalize"); } } norm=Normalize(norm); @@ -1104,9 +1104,9 @@ bool IndexedVertexArray::prep_buff() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer_id_[VA_LINEINDEX_BUFFER]); VERTEX_ARRAY_CHECK_GL_ERROR("bind lindex buf"); glBufferData(GL_ELEMENT_ARRAY_BUFFER, - sizeof(unsigned int) * line_index_list_.size(), - &line_index_list_[0], - GL_STATIC_DRAW); + sizeof(unsigned int) * line_index_list_.size(), + &line_index_list_[0], + GL_STATIC_DRAW); VERTEX_ARRAY_CHECK_GL_ERROR("set lindex buf"); } @@ -1114,9 +1114,9 @@ bool IndexedVertexArray::prep_buff() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer_id_[VA_TRIINDEX_BUFFER]); VERTEX_ARRAY_CHECK_GL_ERROR("bind tindex buf"); glBufferData(GL_ELEMENT_ARRAY_BUFFER, - sizeof(unsigned int) * tri_index_list_.size(), - &tri_index_list_[0], - GL_STATIC_DRAW); + sizeof(unsigned int) * tri_index_list_.size(), + &tri_index_list_[0], + GL_STATIC_DRAW); VERTEX_ARRAY_CHECK_GL_ERROR("set tindex buf"); } @@ -1124,24 +1124,24 @@ bool IndexedVertexArray::prep_buff() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer_id_[VA_QUADINDEX_BUFFER]); VERTEX_ARRAY_CHECK_GL_ERROR("bind qindex buf"); glBufferData(GL_ELEMENT_ARRAY_BUFFER, - sizeof(unsigned int) * quad_index_list_.size(), - &quad_index_list_[0], - GL_STATIC_DRAW); + sizeof(unsigned int) * quad_index_list_.size(), + &quad_index_list_[0], + GL_STATIC_DRAW); VERTEX_ARRAY_CHECK_GL_ERROR("set qindex buf"); } if(use_ambient_) { if(ambient_data_.empty()) { - LOGN_VERBOSE("ambient data empty"); + LOG_VERBOSE("ambient data empty"); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } else { glEnableClientState(GL_TEXTURE_COORD_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, buffer_id_[VA_AMBIENT_BUFFER]); VERTEX_ARRAY_CHECK_GL_ERROR("bind ambient buf"); glBufferData(GL_ARRAY_BUFFER, - sizeof(float) * ambient_data_.size(), - &ambient_data_[0], - GL_STATIC_DRAW); + sizeof(float) * ambient_data_.size(), + &ambient_data_[0], + GL_STATIC_DRAW); VERTEX_ARRAY_CHECK_GL_ERROR("set ambient buf"); } } else { @@ -1199,19 +1199,19 @@ void IndexedVertexArray::draw_ltq(bool use_buff) #endif } else { - LOGN_TRACE("setting up vertex array"); + LOG_TRACE("setting up vertex array"); glInterleavedArrays(GetFormat(),sizeof(Entry),&entry_list_[0]); if(!tri_index_list_.empty() && (mode_ & 0x4)) { - LOGN_TRACE("rendering vertex arras tris"); + LOG_TRACE("rendering vertex arras tris"); glDrawElements(GL_TRIANGLES,tri_index_list_.size(),GL_UNSIGNED_INT,&tri_index_list_[0]); } if(!quad_index_list_.empty() && (mode_ & 0x4)) { - LOGN_TRACE("rendering vertex arras quads"); + LOG_TRACE("rendering vertex arras quads"); glDrawElements(GL_QUADS,quad_index_list_.size(),GL_UNSIGNED_INT,&quad_index_list_[0]); } if(!line_index_list_.empty() && (mode_ & 0x2)) { - LOGN_TRACE("rendering vertex arras lines"); + LOG_TRACE("rendering vertex arras lines"); glDrawElements(GL_LINES,line_index_list_.size(),GL_UNSIGNED_INT,&line_index_list_[0]); } } @@ -1228,7 +1228,7 @@ void IndexedVertexArray::draw_p(bool use_buff) glDrawArrays(GL_POINTS,0,entry_list_.size()); #endif } else { - LOGN_TRACE("calling vertex array"); + LOG_TRACE("calling vertex array"); glInterleavedArrays(GetFormat(),sizeof(Entry),&entry_list_[0]); glDrawArrays(GL_POINTS,0,entry_list_.size()); } diff --git a/modules/gui/src/file_loader.cc b/modules/gui/src/file_loader.cc index 6f56900d3..a874742bc 100644 --- a/modules/gui/src/file_loader.cc +++ b/modules/gui/src/file_loader.cc @@ -339,11 +339,11 @@ gfx::GfxObjP FileLoader::TryLoadAlignment(const QString& filename, try { handler->Import(seq_list,filename.toStdString()); } catch(io::IOException& e) { - LOGN_ERROR(e.what()); + LOG_ERROR(e.what()); return gfx::GfxObjP(); } catch(seq::InvalidSequence& e) { - LOGN_ERROR(e.what()); + LOG_ERROR(e.what()); return gfx::GfxObjP(); } seq::AlignmentHandle alignment = seq::AlignmentFromSequenceList(seq_list); @@ -385,7 +385,7 @@ void FileLoader::LoadPDB(const QString& filename, const QString& selection) try { reader.Import(ent); } catch (io::IOException &e) { - LOGN_ERROR(e.what()); + LOG_ERROR(e.what()); continue; } conop::Conopology::Instance().ConnectAll(builder,ent,0); diff --git a/modules/gui/src/gl_canvas.cc b/modules/gui/src/gl_canvas.cc index 2b7d93f1f..e2029930c 100644 --- a/modules/gui/src/gl_canvas.cc +++ b/modules/gui/src/gl_canvas.cc @@ -98,15 +98,15 @@ void GLCanvas::initializeGL() init=true; } - LOG_DEBUG("GLCanvas::initializeGL()"<<std::endl); + LOG_DEBUG("GLCanvas::initializeGL()"); Scene::Instance().InitGL(); - LOG_DEBUG("GLCanvas::registering with scene"<<std::endl); + LOG_DEBUG("GLCanvas::registering with scene"); Scene::Instance().Register(this); } void GLCanvas::resizeGL(int w, int h) { - LOG_DUMP("GLCanvas::resizeGL("<<w<<","<<h<<")"<<std::endl); + LOG_DEBUG("GLCanvas::resizeGL("<<w<<","<<h<<")"); Scene::Instance().Resize(w,h); } @@ -414,7 +414,7 @@ void GLCanvas::timerEvent(QTimerEvent * event) if(count==20) { count=0; gettimeofday(&time1,NULL); - LOGN_ERROR(20.0/delta_time(time0,time1) << " fps"); + LOG_ERROR(20.0/delta_time(time0,time1) << " fps"); gettimeofday(&time0,NULL); } } diff --git a/modules/gui/src/gl_win.cc b/modules/gui/src/gl_win.cc index 15c892846..7f4f668d6 100644 --- a/modules/gui/src/gl_win.cc +++ b/modules/gui/src/gl_win.cc @@ -61,21 +61,21 @@ GLWin::GLWin(QWidget* p): } if(!gl_canvas_->isValid()) { - LOGN_ERROR("no valid GL context found, GL canvas could not be created"); + LOG_ERROR("no valid GL context found, GL canvas could not be created"); return; } this->SetInternalWidget(main); gfx::Scene::Instance().AttachObserver(this); QGLFormat format = gl_canvas_->format(); - LOGN_VERBOSE("GLCanvas created with rbits=" << format.redBufferSize() - << " gbits=" << format.greenBufferSize() - << " bbits=" << format.blueBufferSize() - << " abits=" << format.alphaBufferSize() - << " dbits=" << format.depthBufferSize() - << " accumbits=" << format.accumBufferSize() - << " multisample=" << format.sampleBuffers() - << " with samples=" << format.samples()); + LOG_VERBOSE("GLCanvas created with rbits=" << format.redBufferSize() + << " gbits=" << format.greenBufferSize() + << " bbits=" << format.blueBufferSize() + << " abits=" << format.alphaBufferSize() + << " dbits=" << format.depthBufferSize() + << " accumbits=" << format.accumBufferSize() + << " multisample=" << format.sampleBuffers() + << " with samples=" << format.samples()); main->setCentralWidget(gl_canvas_); connect(gl_canvas_, SIGNAL(ReleaseFocus()), this, SIGNAL(ReleaseFocus())); connect(&ToolManager::Instance(), SIGNAL(ActiveToolChanged(Tool*)), this, SLOT(ActiveToolChanged(Tool*))); diff --git a/modules/gui/src/gosty.cc b/modules/gui/src/gosty.cc index 8409eecd5..2f50d596b 100644 --- a/modules/gui/src/gosty.cc +++ b/modules/gui/src/gosty.cc @@ -110,7 +110,7 @@ int setup_resources(QApplication& app) { QResource qr(":/images"); if(!qr.isValid()) { - LOGN_ERROR("no valid /image Qt resource found"); + LOG_ERROR("no valid /image Qt resource found"); return -1; } int sizes[]={512,256,128,32,16, 0}; diff --git a/modules/gui/src/python_shell/python_interpreter.cc b/modules/gui/src/python_shell/python_interpreter.cc index 975c6ff41..3dea745a5 100644 --- a/modules/gui/src/python_shell/python_interpreter.cc +++ b/modules/gui/src/python_shell/python_interpreter.cc @@ -89,7 +89,7 @@ unsigned int PythonInterpreter::RunScript(const QString& fname) { QFile script(fname); if (!script.open(QIODevice::ReadOnly | QIODevice::Text)){ - LOGN_ERROR("could not open " << fname.toStdString()); + LOG_ERROR("could not open " << fname.toStdString()); return RunCommand(""); } QString command=script.readAll(); diff --git a/modules/img/alg/src/discrete_shrink.cc b/modules/img/alg/src/discrete_shrink.cc index d3413f0f3..3bc1fa2d1 100644 --- a/modules/img/alg/src/discrete_shrink.cc +++ b/modules/img/alg/src/discrete_shrink.cc @@ -72,7 +72,7 @@ ImageStateBasePtr DiscreteShrinkFnc::VisitState(const ImageStateImpl<T,D>& isi) Extent new_ext(newsize); - LOG_VERBOSE("ds: " << isi.GetExtent() << " " << new_ext << std::endl); + LOG_DEBUG("extent of shrunken image" << isi.GetExtent() << " " << new_ext); geom::Vec3 ao = isi.GetAbsoluteOrigin(); @@ -97,8 +97,6 @@ ImageStateBasePtr DiscreteShrinkFnc::VisitState(const ImageStateImpl<T,D>& isi) dt = div(start[1],bs_[1]); newstart[1] = dt.quot; dt = div(start[2],bs_[2]); newstart[2] = dt.quot; - LOG_VERBOSE("ds: newstart: " << newstart << std::endl); - ni->SetAbsoluteOrigin(ao); ni->SetSpatialOrigin(newstart); ni->GetSampling().SetPixelSampling(CompMultiply(ni->GetSampling().GetPixelSampling(),Vec3(bs_[0],bs_[1],bs_[2]))); diff --git a/modules/img/alg/src/highest_peak_search_3d.cc b/modules/img/alg/src/highest_peak_search_3d.cc index eeedd054f..c8e884577 100644 --- a/modules/img/alg/src/highest_peak_search_3d.cc +++ b/modules/img/alg/src/highest_peak_search_3d.cc @@ -130,10 +130,10 @@ template <typename T, class D> void HighestPeakSearch3DBase::VisitState(const ImageStateImpl<T,D>& isi) { - LOG_VERBOSE("highest peak search with the parameters" << std::endl); - LOG_VERBOSE(" max number of peaks: " << max_num_peaks_ << std::endl); - LOG_VERBOSE(" exclusion radius: " << exclusion_radius_ << std::endl); - LOG_VERBOSE(" threshold: " << threshold_ << std::endl); + LOG_DEBUG("highest peak search (" + << "max number of peaks: " << max_num_peaks_ << ", " + << "exclusion radius: " << exclusion_radius_ << ", " + << "threshold: " << threshold_ << ")"); if (max_num_peaks_ < 1) { @@ -142,15 +142,16 @@ template <typename T, class D> if(ext_list_.size()==0) { - LOG_VERBOSE(" excluded regions: none" << std::endl); + LOG_DEBUG(" excluded regions: none"); } else { - LOG_VERBOSE(" excluded regions:" << std::endl); + std::stringstream ss; for(ExtList::const_iterator it=ext_list_.begin();it!=ext_list_.end();++it) { - LOG_VERBOSE(" " << (*it) << std::endl); + ss << " " << (*it); } + LOG_DEBUG("exluded regions:" << ss.str()); } detail::PeakCollector peak_collector(max_num_peaks_,exclusion_radius_); diff --git a/modules/img/base/pymod/export_image_handle.cc b/modules/img/base/pymod/export_image_handle.cc index 942e7b61c..379a4cde2 100644 --- a/modules/img/base/pymod/export_image_handle.cc +++ b/modules/img/base/pymod/export_image_handle.cc @@ -84,7 +84,6 @@ inline ImageHandle g2a(const Data& d,const Extent& e) inline ImageHandle ih_copy1(ImageHandle& h) {return h.Copy();} inline ImageHandle ih_copy2(ImageHandle& h, bool cc) {return h.Copy(cc);} -inline ImageHandle ih_copy3(ImageHandle& h, const Extent& e) {return h.Copy(e);} } // anon ns @@ -112,7 +111,6 @@ void export_ImageHandle() class_<ImageHandle, bases<Data> >("ImageHandle", no_init ) .def("Copy",ih_copy1) .def("Copy",ih_copy2,args("content_flag")) - .def("Copy",ih_copy3,args("extent")) .def("Extract",&ImageHandle::Extract,args("extent")) .def("Paste",&ImageHandle::Paste,args("data")) .def("Set",&ImageHandle::Set,args("image")) diff --git a/modules/img/base/src/image_handle.cc b/modules/img/base/src/image_handle.cc index 712868a31..3490869b5 100644 --- a/modules/img/base/src/image_handle.cc +++ b/modules/img/base/src/image_handle.cc @@ -93,12 +93,6 @@ ImageHandle ImageHandle::Copy(bool cc) const return ImageHandle(StatePtrPtr(new ImageStateBasePtr(ImageStatePtr()->Clone(cc)))); } -ImageHandle ImageHandle::Copy(const Extent& e) const -{ - LOG_MESSAGE("ImageHandle::Copy(Extent) ist deprecated, use Extract() instead" << std::endl); - return Extract(e); -} - ImageHandle ImageHandle::Extract(const Extent& e) const { #if 0 @@ -662,12 +656,6 @@ ImageHandle ConstImageHandle::Copy(bool cc) const return handle_.Copy(cc); } -ImageHandle ConstImageHandle::Copy(const Extent& e) const -{ - LOG_MESSAGE("ConstImageHandle::Copy(Extent) ist deprecated, use Extract() instead" << std::endl); - return handle_.Extract(e); -} - ImageHandle ConstImageHandle::Extract(const Extent& e) const { return handle_.Extract(e); diff --git a/modules/img/base/src/image_handle.hh b/modules/img/base/src/image_handle.hh index d85bbc583..ef0493487 100644 --- a/modules/img/base/src/image_handle.hh +++ b/modules/img/base/src/image_handle.hh @@ -153,9 +153,6 @@ public: */ ImageHandle Copy(bool cc=true) const; - //! DEPRECATED - ImageHandle Copy(const Extent& e) const; - //! return a handle to a new image containing a partial copy /*! The returning domain will match the type (ie REAL or COMPLEX), @@ -561,9 +558,6 @@ public: //! see ImageHandle::Copy(bool) ImageHandle Copy(bool cc=true) const; - //! DEPRECATED - ImageHandle Copy(const Extent& e) const; - //! see ImageHandle::Copy(const Extent&) ImageHandle Extract(const Extent& e) const; diff --git a/modules/img/base/src/pixel_sampling.cc b/modules/img/base/src/pixel_sampling.cc index 5cff35235..0ba2c608d 100644 --- a/modules/img/base/src/pixel_sampling.cc +++ b/modules/img/base/src/pixel_sampling.cc @@ -122,7 +122,7 @@ Vec3 PixelSampling::Vec2Coord(const Vec3& p) const void PixelSampling::set_spat_scale(const Vec3& dim) { if(dim[0]<=0.0 || dim[1]<0.0 || dim[2]<0.0) { - LOG_ERROR("invalid spatial pixel sampling, must be >0" << std::endl); + LOG_ERROR("invalid spatial pixel sampling, must be >0"); return; } spat_scale_=dim; diff --git a/modules/index.rst b/modules/index.rst index 775940a59..867052574 100644 --- a/modules/index.rst +++ b/modules/index.rst @@ -84,7 +84,7 @@ Graphical User Interface Extending OpenStructure -------------------------------------------------------------------------------- -**Howto:** :doc:`write new modules <newmodule>` | :doc:`integrate third-party tools <external>` +**Howto:** :doc:`write new modules <newmodule>` | :doc:`integrate third-party tools <external>` | :doc:`logging <base/logging>` diff --git a/modules/io/src/convert.cc b/modules/io/src/convert.cc index 0d9ac8865..8cc6a83ea 100644 --- a/modules/io/src/convert.cc +++ b/modules/io/src/convert.cc @@ -226,7 +226,7 @@ void to_vax_converter_float_helper(const unsigned int* in, unsigned int * out) if ( e == EXPONENT_MASK ) { // VAX's have no equivalents for IEEE +-Infinity and +-NaN [e=all-1's] // Fixup to VAX +-extrema [e=all-1's] with zero mantissa [m=0] - LOGN_ERROR("IEEE Infinity or NaN encountered. Fixup to VAX extrema"); + LOG_ERROR("IEEE Infinity or NaN encountered. Fixup to VAX extrema"); *out = (*in & SIGN_BIT) | EXPONENT_MASK; }else{ e >>= MANTISSA_SIZE; // Obtain the biased IEEE exponent @@ -243,7 +243,7 @@ void to_vax_converter_float_helper(const unsigned int* in, unsigned int * out) // Silent underflow *out=0;; }else if( e > ( 2 * VAX_F_EXPONENT_BIAS - 1 ) ){ - LOGN_ERROR("Overflow. Fixup to VAX extrema"); + LOG_ERROR("Overflow. Fixup to VAX extrema"); *out = ( *in & SIGN_BIT ) | ~SIGN_BIT; }else{ // VAX normalized form [e>0] (both mantissas are 23 bits) @@ -259,7 +259,7 @@ void from_vax_converter_float_helper(const unsigned int* in, unsigned int * out) // If the biased VAX exponent is zero [e=0] if ( ( *in & SIGN_BIT ) == SIGN_BIT ){ // If negative [s=1] - LOGN_ERROR("VAX reserved operand fault; fixup to IEEE zero"); + LOG_ERROR("VAX reserved operand fault; fixup to IEEE zero"); } // Set VAX dirty [m<>0] or true [m=0] zero to IEEE +zero [s=e=m=0] *out = 0; diff --git a/modules/io/src/img/load_map.cc b/modules/io/src/img/load_map.cc index f700d3736..c120c6e35 100644 --- a/modules/io/src/img/load_map.cc +++ b/modules/io/src/img/load_map.cc @@ -27,19 +27,19 @@ namespace ost { namespace io { -DLLEXPORT_OST_IO img::ImageHandle LoadImage(const boost::filesystem::path& loc) +img::ImageHandle LoadImage(const boost::filesystem::path& loc) { UndefinedImageFormat undefined; return LoadImage(loc,undefined); } -DLLEXPORT_OST_IO img::ImageHandle LoadImage(const boost::filesystem::path& loc, const ImageFormatBase& formatstruct) +img::ImageHandle LoadImage(const boost::filesystem::path& loc, const ImageFormatBase& formatstruct) { if(!boost::filesystem::exists(loc)){ throw IOException("file not found: " + loc.string()); } - LOG_DUMP("creating MapIOHandler for " << loc.string() << std::endl); + LOG_DEBUG("creating MapIOHandler for " << loc.string()); MapIOHandlerPtr map_io = IOManager::Instance().FindMapImportHandlerFile(loc,formatstruct); @@ -49,7 +49,7 @@ DLLEXPORT_OST_IO img::ImageHandle LoadImage(const boost::filesystem::path& loc, img::ImageHandle ih = CreateImage(img::Extent(),img::REAL,img::SPATIAL); - LOG_DUMP("calling import on map io handle" << std::endl); + LOG_DEBUG("calling import on map io handle"); map_io->Import(ih,loc,formatstruct); // TODO: fix this in regard to automatic copy of ConstData info obj @@ -59,40 +59,40 @@ DLLEXPORT_OST_IO img::ImageHandle LoadImage(const boost::filesystem::path& loc, return ih; } -DLLEXPORT_OST_IO void SaveImage(const img::ImageHandle& image, const boost::filesystem::path& loc) +void SaveImage(const img::ImageHandle& image, const boost::filesystem::path& loc) { UndefinedImageFormat undefined; SaveImage(image,loc,undefined); } -DLLEXPORT_OST_IO void SaveImage(const img::ImageHandle& image, const boost::filesystem::path& loc,const ImageFormatBase& formatstruct) +void SaveImage(const img::ImageHandle& image, const boost::filesystem::path& loc,const ImageFormatBase& formatstruct) { MapIOHandlerPtr map_io = IOManager::Instance().FindMapExportHandlerFile(loc,formatstruct); if(!map_io) { throw IOUnknownFormatException("could not find io-plugin for " + loc.string()); } - LOG_DUMP("calling export on map io handle" << std::endl); + LOG_DEBUG("calling export on map io handle"); map_io->Export(image, loc,formatstruct); } -DLLEXPORT_OST_IO img::MapHandle LoadMap(const boost::filesystem::path& loc, const ImageFormatBase& formatstruct) +img::MapHandle LoadMap(const boost::filesystem::path& loc, const ImageFormatBase& formatstruct) { return LoadImage(loc,formatstruct); } -DLLEXPORT_OST_IO img::MapHandle LoadMap(const boost::filesystem::path& loc) +img::MapHandle LoadMap(const boost::filesystem::path& loc) { return LoadImage(loc); } -DLLEXPORT_OST_IO void SaveMap(const img::ImageHandle& image, const boost::filesystem::path& loc,const ImageFormatBase& formatstruct ) +void SaveMap(const img::ImageHandle& image, const boost::filesystem::path& loc,const ImageFormatBase& formatstruct ) { SaveImage(image,loc,formatstruct); } -DLLEXPORT_OST_IO void SaveMap(const img::ImageHandle& image, const boost::filesystem::path& loc) +void SaveMap(const img::ImageHandle& image, const boost::filesystem::path& loc) { SaveImage(image,loc); } diff --git a/modules/io/src/img/map_io_dm3_handler.cc b/modules/io/src/img/map_io_dm3_handler.cc index b53c6b1b2..359d396f2 100644 --- a/modules/io/src/img/map_io_dm3_handler.cc +++ b/modules/io/src/img/map_io_dm3_handler.cc @@ -74,9 +74,9 @@ void value_convert(void* src_ptr, DEST* dest_ptr, size_t count) { SOURCE* r_src_ptr = reinterpret_cast<SOURCE*>(src_ptr); for(uint c=0;c<count;++c) { - LOG_VERBOSE(" " << c << " / " << count << " ."); + LOG_TRACE(" " << c << " / " << count << " ."); DEST val=static_cast<DEST>(r_src_ptr[c]); - LOG_VERBOSE(" ." << std::endl); + LOG_TRACE(" ." << std::endl); dest_ptr[c] = val; } } @@ -216,7 +216,7 @@ void DM3Collector::ParseFile(const bf::path& loc) { throw IOException("could not open "+loc.string()); } - LOG_VERBOSE("Starting DM3 Parsing" << std::endl); + LOG_DEBUG("Starting DM3 Parsing" << std::endl); this->ParseStream(ifile); ifile.close(); } @@ -231,16 +231,16 @@ void DM3Collector::ParseStream(std::istream& fp) uint endianess; file_read(&endianess,sizeof(uint),1,fp); - LOG_MESSAGE("version: " << version << std::endl); - LOG_MESSAGE("bytecount: " << bytecount << std::endl); - LOG_MESSAGE("endianess: " << endianess << std::endl); + LOG_INFO("version: " << version); + LOG_INFO("bytecount: " << bytecount); + LOG_INFO("endianess: " << endianess); parse_tag_group(0,"ROOT",fp); img::Progress::Instance().DeRegister(this); if(fp.eof()==0) { - LOG_ERROR("file not parsed completely" << std::endl); + LOG_ERROR("file not parsed completely"); } else { - LOG_VERBOSE("file parsed completely" << std::endl); + LOG_INFO("file parsed completely"); } } @@ -320,7 +320,9 @@ void DM3Collector::check_image() image_handle_list_.push_back(ih); } else { - LOG_ERROR("missmatch in byte size of data (" << data_size*type_sizeof(image_number_type_) << " != " << image_data_byte_size_ << "), ignoring this image entry" << std::endl); + LOG_ERROR("missmatch in byte size of data (" + << data_size*type_sizeof(image_number_type_) << " != " + << image_data_byte_size_ << "), ignoring this image entry"); } image_width_=0; @@ -348,7 +350,7 @@ size_t DM3Collector::type_sizeof(uint n) void DM3Collector::parse_tag_group(int depth, const String& name,std::istream& fp) { - LOG_VERBOSE(String(depth,' ') << "parsing tag group [" << name << "]" << std::endl); + LOG_TRACE(String(depth,' ') << "parsing tag group [" << name << "]"); uchar sorted; file_read(&sorted,sizeof(uchar),1,fp); @@ -356,13 +358,14 @@ void DM3Collector::parse_tag_group(int depth, const String& name,std::istream& f uchar open; file_read(&open,sizeof(uchar),1,fp); - LOG_VERBOSE(String(depth,' ') << "s,o: " << static_cast<int>(sorted) << "," << static_cast<int>(open) << std::endl); + LOG_TRACE(String(depth,' ') << "s,o: " << static_cast<int>(sorted) << "," + << static_cast<int>(open)); uint tag_count; file_read(&tag_count,sizeof(uint),1,fp); if(swap_tag_) swap_uint(&tag_count,1); - LOG_VERBOSE(String(depth,' ') << "tag_count: " << tag_count << std::endl); + LOG_TRACE(String(depth,' ') << "tag_count: " << tag_count); handle_tag_group(name); @@ -373,12 +376,12 @@ void DM3Collector::parse_tag_group(int depth, const String& name,std::istream& f void DM3Collector::parse_tag_entry(int depth,std::istream& fp) { - LOG_VERBOSE(String(depth,' ') << "parsing tag entry" << std::endl); + LOG_TRACE(String(depth,' ') << "parsing tag entry"); uchar id; file_read(&id,sizeof(uchar),1,fp); - LOG_VERBOSE(String(depth,' ') << "id: " << static_cast<int>(id) << std::endl); + LOG_TRACE(String(depth,' ') << "id: " << static_cast<int>(id)); if(!(id==20 || id==21)) { std::ostringstream msg(""); @@ -397,7 +400,8 @@ void DM3Collector::parse_tag_entry(int depth,std::istream& fp) label=String(&buffer[0],nlabel); } - LOG_MESSAGE(String(depth,' ') << "nlabel: " << nlabel << " label: '" << label << "'" << std::endl); + LOG_TRACE(String(depth,' ') << "nlabel: " << nlabel << " label: '" + << label << "'" << std::endl); if(id==static_cast<uchar>(20)) { parse_tag_group(depth+1,label,fp); @@ -409,7 +413,7 @@ void DM3Collector::parse_tag_entry(int depth,std::istream& fp) void DM3Collector::parse_tag_type(int depth, const String& name, std::istream& fp) { - LOG_VERBOSE(String(depth,' ') << "parsing tag type" << std::endl); + LOG_TRACE(String(depth,' ') << "parsing tag type"); char dummy[4]; file_read(dummy,sizeof(char),4,fp); @@ -417,21 +421,21 @@ void DM3Collector::parse_tag_type(int depth, const String& name, std::istream& f if(String(dummy,4)!=String("%%%%")) { throw IOException("I/O Dm3: invalid tag_type magic number"); } else { - LOG_VERBOSE(String(depth,' ') << "magic number %%%% found" << std::endl); + LOG_TRACE(String(depth,' ') << "magic number %%%% found"); } uint ntype; file_read(&ntype,sizeof(uint),1,fp); if(swap_tag_) swap_uint(&ntype,1); - LOG_VERBOSE(String(depth,' ') << "ntype: " << ntype << std::endl); + LOG_TRACE(String(depth,' ') << "ntype: " << ntype); std::vector<uint> tag_type_info(ntype); file_read(&tag_type_info[0],sizeof(uint),ntype,fp); if(swap_tag_) swap_uint(&tag_type_info[0],ntype); for(uint i=0;i<ntype;++i) { - LOG_VERBOSE(String(depth,' ') << "type_info[" << i << "]: " << tag_type_info[i] << std::endl); + LOG_TRACE(String(depth,' ') << "type_info[" << i << "]: " << tag_type_info[i]); } if(ntype==1) { // simple type @@ -452,7 +456,7 @@ void DM3Collector::parse_tag_type(int depth, const String& name, std::istream& f void DM3Collector::parse_tag_type_single(int depth, const String& name,TagTypeInfo& tag_type_info,std::istream& fp) { - LOG_VERBOSE(String(depth,' ') << "parsing simple tag [" << name << "]" << std::endl); + LOG_TRACE(String(depth,' ') << "parsing simple tag [" << name << "]"); // tag_type_info[0] contains number type uint number_type=tag_type_info[0]; @@ -461,7 +465,7 @@ void DM3Collector::parse_tag_type_single(int depth, const String& name,TagTypeIn msg << "I/O Dm3: unexpected number type " << number_type << " for simple type"; throw IOException(msg.str()); } else { - LOG_VERBOSE(String(depth,' ') << "reading simple value of number_type " << number_type << std::endl); + LOG_TRACE(String(depth,' ') << "reading simple value of number_type " << number_type); } uchar buffer[16]; // sufficient for all primitive types @@ -470,14 +474,14 @@ void DM3Collector::parse_tag_type_single(int depth, const String& name,TagTypeIn // TODO: swap data double tmp; tag_value_convert<double>(number_type,buffer,&tmp); - LOG_VERBOSE(String(depth,' ') << "value: " << tmp << std::endl); + LOG_TRACE(String(depth,' ') << "value: " << tmp); handle_single_tag(name,number_type,buffer); } void DM3Collector::parse_tag_type_String(int depth, const String& name, TagTypeInfo& tag_type_info,std::istream& fp) { - LOG_VERBOSE (String(depth,' ') << "parsing String tag [" << name << "]" << std::endl); + LOG_TRACE(String(depth,' ') << "parsing String tag [" << name << "]"); // tag_type_info[0] contains number type 18 // tag_type_info[1] contains String length std::vector<char> buffer(tag_type_info[1]*2); @@ -486,7 +490,7 @@ void DM3Collector::parse_tag_type_String(int depth, const String& name, TagTypeI void DM3Collector::parse_tag_type_array(int depth, const String& name, TagTypeInfo& tag_type_info,std::istream& fp) { - LOG_VERBOSE(String(depth,' ') << "parsing array tag [" << name << "]" << std::endl); + LOG_TRACE(String(depth,' ') << "parsing array tag [" << name << "]"); // tag_type_info[0] contains number type 20 // tag_type_info[1] contains array number type // tag_type_info[2] contains array length @@ -496,12 +500,12 @@ void DM3Collector::parse_tag_type_array(int depth, const String& name, TagTypeIn msg << "I/O Exception: unexpected number type " << number_type << " for array"; throw IOException(msg.str()); } else { - LOG_VERBOSE(String(depth,' ') << "parsing array of number_type " << number_type << std::endl); + LOG_TRACE(String(depth,' ') << "parsing array of number_type " << number_type); } size_t array_type_size = type_sizeof(number_type); - LOG_VERBOSE(String(depth,' ') << "array byte size: " << array_type_size*tag_type_info[2] << std::endl); + LOG_TRACE(String(depth,' ') << "array byte size: " << array_type_size*tag_type_info[2]); //std::vector<uchar> data(array_type_size*tag_type_info[2]); boost::shared_array<uchar> array_data(new uchar[array_type_size*tag_type_info[2]]); @@ -512,7 +516,7 @@ void DM3Collector::parse_tag_type_array(int depth, const String& name, TagTypeIn void DM3Collector::parse_tag_type_simple_struct(int depth, const String& name, TagTypeInfo& tag_type_info,std::istream& fp) { - LOG_VERBOSE(String(depth,' ') << "parsing simple struct tag [" << name << "]" << std::endl); + LOG_TRACE(String(depth,' ') << "parsing simple struct tag [" << name << "]"); // tag_type_info[0] contains number type 15 if(tag_type_info[0]!=15) { std::ostringstream msg(""); @@ -521,7 +525,7 @@ void DM3Collector::parse_tag_type_simple_struct(int depth, const String& name, T } // tag_type_info[2] contains number of entries in struct - LOG_VERBOSE(String(depth,' ') << "reading in " << tag_type_info[2] << " values" << std::endl); + LOG_TRACE(String(depth,' ') << "reading in " << tag_type_info[2] << " values"); std::vector<uint> number_types(tag_type_info[2]); std::vector<long> buffers(tag_type_info[2]); for(uint c=0;c<tag_type_info[2];++c) { @@ -531,14 +535,14 @@ void DM3Collector::parse_tag_type_simple_struct(int depth, const String& name, T msg << "I/O Dm3: unexpected number type " << number_types[c] << " while parsing tag_type_struct"; throw IOException(msg.str()); } else { - LOG_VERBOSE("reading value of number_type " << number_types[c] << std::endl); + LOG_TRACE("reading value of number_type " << number_types[c]); } size_t bufsize = type_sizeof(number_types[c]); void* buffer = &buffers[c]; file_read(buffer,bufsize,1,fp); double tmp; tag_value_convert<double>(number_types[c],buffer,&tmp); - LOG_VERBOSE(String(depth,' ') << "value " << c << ": " << tmp << std::endl); + LOG_TRACE(String(depth,' ') << "value " << c << ": " << tmp); // TODO: swap data } handle_struct_tag(name,number_types,buffers); @@ -547,7 +551,7 @@ void DM3Collector::parse_tag_type_simple_struct(int depth, const String& name, T void DM3Collector::parse_tag_type_array_struct(int depth, const String& name, TagTypeInfo& tag_type_info,std::istream& fp) { - LOG_VERBOSE(String(depth,' ') << "parsing array struct tag [" << name << "]" << std::endl); + LOG_DEBUG(String(depth,' ') << "parsing array struct tag [" << name << "]"); // tag_type_info[0] contains number type 20 if(tag_type_info[0]!=20) { std::ostringstream msg(""); @@ -558,20 +562,22 @@ void DM3Collector::parse_tag_type_array_struct(int depth, const String& name, Ta // tag_type_info[size-1] contains length of array! uint array_size = tag_type_info[tag_type_info.size()-1]; - LOG_VERBOSE(String(depth,' ') << "looping over " << array_size << " array elements" << std::endl); + LOG_TRACE(String(depth,' ') << "looping over " << array_size + << " array elements"); uchar buffer[16]; // sufficient for all primitive types for(uint ac=0;ac<array_size;++ac) { // tag_type_info[3] contains number of entries in struct - LOG_VERBOSE(String(depth,' ') << "reading in " << tag_type_info[3] << " values for array entry " << ac << std::endl); + LOG_TRACE(String(depth,' ') << "reading in " << tag_type_info[3] << " values for array entry "); for(uint c=0;c<tag_type_info[3];++c) { uint number_type=tag_type_info[c*2+5]; if(number_type>10) { - std::ostringstream msg(""); - msg << "I/O Dm3: unexpected number type " << number_type << " while parsing tag_type_struct"; - throw IOException(msg.str()); + std::ostringstream msg; + msg << "I/O Dm3: unexpected number type " << number_type + << " while parsing tag_type_struct"; + throw IOException(msg.str()); } else { - LOG_VERBOSE(String(depth,' ') << "reading value of number_type " << number_type << std::endl); + LOG_TRACE(String(depth, ' ') << "reading value of number_type " << number_type); } size_t bufsize = type_sizeof(number_type); file_read(buffer,bufsize,1,fp); diff --git a/modules/io/src/img/map_io_jpk_handler.cc b/modules/io/src/img/map_io_jpk_handler.cc index 2f36a21ed..8f778b3ac 100644 --- a/modules/io/src/img/map_io_jpk_handler.cc +++ b/modules/io/src/img/map_io_jpk_handler.cc @@ -89,8 +89,8 @@ void MapIOJpkHandler::Import(img::ImageHandle& image, const boost::filesystem::p } image*=(*scale*units_scale); image+=(*base*units_scale); - LOG_MESSAGE("jpk_plugin: scalefactor: " << *scale << " offset: " - << *base<< std::endl); + LOG_INFO("jpk_plugin: scalefactor: " << *scale + << " offset: " << *base); } else { throw IOException("Missing scaling tags"); } @@ -107,7 +107,7 @@ void MapIOJpkHandler::Import(img::ImageHandle& image, const boost::filesystem::p } char* s; TIFFGetField(tfile, jpk_tags::EncoderUnit(newformat.GetSubimage()), &count, &s); - LOG_MESSAGE("jpk_plugin: units: " << s << std::endl); + LOG_INFO("jpk_plugin: units: " << s); Real* sx; @@ -118,7 +118,7 @@ void MapIOJpkHandler::Import(img::ImageHandle& image, const boost::filesystem::p image.SetPixelSampling(geom::Vec3(*sx/static_cast<Real>(image.GetSize()[0])*Units::m, *sy/static_cast<Real>(image.GetSize()[1])*Units::m, 1)); - LOG_MESSAGE("jpk_plugin: sx: " << *sx << " sy: "<< *sy<< std::endl); + LOG_INFO("jpk_plugin: sx: " << *sx << " sy: "<< *sy); } else { throw IOException("Missing size tags"); @@ -184,8 +184,8 @@ void MapIOJpkHandler::Import(img::MapHandle& image, std::istream& loc,const Imag } image*=(*scale*units_scale); image+=(*base*units_scale); - LOG_MESSAGE("jpk_plugin: scalefactor: " << *scale << " offset: " - << *base<< std::endl); + LOG_INFO("jpk_plugin: scalefactor: " << *scale << " offset: " + << *base); }else { throw IOException("Missing scaling tags"); } @@ -202,7 +202,7 @@ void MapIOJpkHandler::Import(img::MapHandle& image, std::istream& loc,const Imag } char* s; TIFFGetField(tfile, jpk_tags::EncoderUnit(newformat.GetSubimage()), &count, &s); - LOG_MESSAGE("jpk_plugin: units: " << s << std::endl); + LOG_INFO("jpk_plugin: units: " << s); Real* sx; @@ -213,7 +213,7 @@ void MapIOJpkHandler::Import(img::MapHandle& image, std::istream& loc,const Imag image.SetPixelSampling(geom::Vec3(*sx/static_cast<Real>(image.GetSize()[0])*Units::m, *sy/static_cast<Real>(image.GetSize()[1])*Units::m, 1)); - LOG_MESSAGE("jpk_plugin: sx: " << *sx << " sy: "<< *sy<< std::endl); + LOG_INFO("jpk_plugin: sx: " << *sx << " sy: "<< *sy); } else { throw IOException("Missing size tags"); diff --git a/modules/io/src/img/map_io_mrc_handler.cc b/modules/io/src/img/map_io_mrc_handler.cc index d70a3b608..aa4a1cf40 100644 --- a/modules/io/src/img/map_io_mrc_handler.cc +++ b/modules/io/src/img/map_io_mrc_handler.cc @@ -306,14 +306,14 @@ public: } void Print() { - LOG_MESSAGE("ncrs: " << nc << " " << nr << " " << ns << std::endl); - LOG_MESSAGE("mode " << mode << std::endl); - LOG_MESSAGE("nxyz: " << nx << " " << ny << " " << nz << std::endl); - LOG_MESSAGE("cell: " << x << " " << y << " " << z); - LOG_MESSAGE(alpha << " " << beta << " " << gamma << std::endl); - LOG_MESSAGE("order: " << mapc << mapr << maps << std::endl); - LOG_MESSAGE("sg: " << ispg << " " << nsymbt << std::endl); - LOG_MESSAGE("nlabel: " << nlabel << std::endl); + LOG_INFO("ncrs: " << nc << " " << nr << " " << ns); + LOG_INFO("mode " << mode); + LOG_INFO("nxyz: " << nx << " " << ny << " " << nz); + LOG_INFO("cell: " << x << " " << y << " " << z); + LOG_INFO(alpha << " " << beta << " " << gamma); + LOG_INFO("order: " << mapc << mapr << maps); + LOG_INFO("sg: " << ispg << " " << nsymbt); + LOG_INFO("nlabel: " << nlabel); } int nc,nr,ns; @@ -348,9 +348,9 @@ public: } void Print() { - LOG_MESSAGE("mrc header" << std::endl); + LOG_INFO("mrc header"); header_base::Print(); - LOG_MESSAGE("ori: " << xorigin << " " << yorigin << std::endl); + LOG_INFO("ori: " << xorigin << " " << yorigin); } static int DetermineDataFormat( std::istream& f) { @@ -372,7 +372,7 @@ public: }else if(x>0.0 || x<1.0) { Convert<OST_VAX_DATA,float>::FromIP(&x); if(x<1.0) { - LOG_VERBOSE("suspicious floating Point value in mrc header" << std::endl); + LOG_VERBOSE("suspicious floating Point value in mrc header"); return OST_LITTLE_ENDIAN; }else{ return OST_VAX_DATA; @@ -474,13 +474,13 @@ public: f.seekg(0,std::ios::beg); // seek to beginning char float_machst= machst[0] & 0x0f; if(float_machst == 1){ - LOGN_DEBUG("CCP4Import: reading big endian data"); + LOG_DEBUG("CCP4Import: reading big endian data"); return OST_BIG_ENDIAN; }else if(float_machst == 2){ - LOGN_DEBUG("CCP4Import: reading vax data"); + LOG_DEBUG("CCP4Import: reading vax data"); return OST_VAX_DATA; }else if(float_machst == 4){ - LOGN_DEBUG("CCP4Import: reading little endian data"); + LOG_DEBUG("CCP4Import: reading little endian data"); return OST_LITTLE_ENDIAN; } else{ throw(IOException("CCP4Import: Cray, Convex native and Fijitsu VP formats are not supported.")); @@ -493,9 +493,9 @@ public: using boost::format; namespace bf = boost::filesystem; - LOGN_MESSAGE("ccp4 header:"); + LOG_INFO("ccp4 header:"); header_base::Print(); - LOGN_MESSAGE(" arms: " << arms); + LOG_INFO(" arms: " << arms); } int lskflag; @@ -629,16 +629,16 @@ void complex_filler(img::image_state::ComplexHalfFrequencyImageState& isi, // complex conjugate fhandle >> real >> imag; isi.Value(p)=Complex(Real(real),-Real(imag)); - LOG_DEBUG(" " << p << " " << isi.Value(p) << std::endl); + LOG_DEBUG(" " << p << " " << isi.Value(p)); } if(sr==header.nr) { // why set point (py,header.ny/2,pz)? // isi.Value(Point(py,header.ny/2,pz))=scale*Complex(Real(real),Real(imag)); - // LOG_DEBUG("+" << Point(py,header.ny/2,pz) << " <- " << Point(sx,cy,sz) << " " << " " << isi.Value(Point(py,header.ny/2,pz)) << std::endl); + // LOG_DEBUG("+" << Point(py,header.ny/2,pz) << " <- " << Point(sx,cy,sz) << " " << " " << isi.Value(Point(py,header.ny/2,pz))); p[mapc]=p[header.mapr]; p[mapr]=header.nr/2; isi.Value(p)=Complex(Real(real),Real(imag)); - LOG_DEBUG("+" << p << " " << isi.Value(p) << std::endl); + LOG_DEBUG("+" << p << " " << isi.Value(p)); } Progress::Instance().AdvanceProgress(&this_dummy); } @@ -650,11 +650,11 @@ void complex_filler(img::image_state::ComplexHalfFrequencyImageState& isi, p[mapc]=sc; fhandle >> real >> imag; isi.Value(p)=Complex(Real(real),Real(imag)); - LOG_DEBUG(" " << p << " " << isi.Value(p) << std::endl); + LOG_DEBUG(" " << p << " " << isi.Value(p)); } p[mapc]=sc; isi.Value(p)=Complex(Real(real),-Real(imag)); - LOG_DEBUG(" " << p << " " << isi.Value(p) << std::endl); + LOG_DEBUG(" " << p << " " << isi.Value(p)); Progress::Instance().AdvanceProgress(&this_dummy); } // set second half of r=0 and r=nr/2 line @@ -663,10 +663,10 @@ void complex_filler(img::image_state::ComplexHalfFrequencyImageState& isi, p[mapr]=0; p[maps]=ss; isi.Value(Point(-p[0],p[1],p[2]))=std::conj(isi.Value(p)); - LOG_DEBUG(" " << Point(-p[0],p[1],p[2]) << " <- " << p << "**" << std::endl); + LOG_DEBUG(" " << Point(-p[0],p[1],p[2]) << " <- " << p << "**"); p[mapr]=header.nr/2; isi.Value(p)=std::conj(isi.Value(Point(-p[0],p[1],p[2]))); - LOG_DEBUG(" " << p << " <- " << Point(-p[0],p[1],p[2]) << "**" << std::endl); + LOG_DEBUG(" " << p << " <- " << Point(-p[0],p[1],p[2]) << "**"); } } Progress::Instance().DeRegister(&this_dummy); @@ -742,7 +742,7 @@ void complex_dumper(BinaryOStream<CONVERSIONTYPE>& f, pnt[mapc]=-sc; Complex val = conj(norm.Convert(isc->Value(pnt))); f << static_cast<B>(val.real()) << static_cast<B>(val.imag()); - LOG_DEBUG(" " << pnt << " " << val << std::endl); + LOG_DEBUG(" " << pnt << " " << val); } f << static_cast<B>(0.0) << static_cast<B>(0.0); Progress::Instance().AdvanceProgress(&this_dummy); @@ -755,12 +755,12 @@ void complex_dumper(BinaryOStream<CONVERSIONTYPE>& f, pnt[mapc]=sc; Complex val =norm.Convert(isc->Value(pnt)); f << static_cast<B>(val.real()) << static_cast<B>(val.imag()); - LOG_DEBUG(" " << pnt << " " << val << std::endl); + LOG_DEBUG(" " << pnt << " " << val); } pnt[mapc]=sc; Complex val = norm.Convert(conj(isc->Value(pnt))); f << static_cast<B>(val.real()) << static_cast<B>(val.imag()); - LOG_DEBUG(" " << pnt << " " << val << std::endl); + LOG_DEBUG(" " << pnt << " " << val); Progress::Instance().AdvanceProgress(&this_dummy); } } @@ -805,9 +805,9 @@ void import_helper(img::MapHandle& image, std::istream& in,const MRC& formatmrc) static_cast<Real>(header.y)/static_cast<Real>(header.ny), static_cast<Real>(header.z)/static_cast<Real>(header.nz))); }else{ - LOG_MESSAGE("Suspicious dell dimensions found. Cannot set sampling."); + LOG_INFO("Suspicious dell dimensions found. Cannot set sampling."); } - LOG_MESSAGE("resulting image extent: " << image.GetExtent() << std::endl); + LOG_INFO("resulting image extent: " << image.GetExtent()); if(img::image_state::RealSpatialImageState *rs=dynamic_cast<img::image_state::RealSpatialImageState*>(image.ImageStatePtr().get())) { if(header.mode==0) { detail::real_filler<uchar,CONVERSIONTYPE>(*rs,f,header); @@ -939,22 +939,22 @@ void MapIOMrcHandler::Import(img::MapHandle& sh, std::istream& loc, const ImageF std::istream head_str(&head_strbuf); head_strbuf.push(boost::iostreams::basic_array_source<char>(headerptr,sizeof(header_))); if (formatmrc.GetSubformat()==MRC_OLD_FORMAT) { - LOGN_DEBUG("mrc io: importing old style format"); + LOG_DEBUG("mrc io: importing old style format"); detail::import_endianess_switcher<detail::mrc_header>(sh,loc,head_str,formatmrc); } else if (formatmrc.GetSubformat()==MRC_NEW_FORMAT) { - LOGN_DEBUG("mrc io: importing new style format"); + LOG_DEBUG("mrc io: importing new style format"); detail::import_endianess_switcher<detail::ccp4_header>(sh,loc,head_str,formatmrc); } else if (is_file_ && (detail::FilenameEndsWith(filename_,".ccp4") || detail::FilenameEndsWith(filename_,".map") || detail::FilenameEndsWith(filename_,".map.gz"))) { - LOGN_DEBUG("mrc io: importing new style format"); + LOG_DEBUG("mrc io: importing new style format"); detail::import_endianess_switcher<detail::ccp4_header>(sh,loc,head_str,formatmrc); } else { unsigned char header_content[256]; memcpy(&header_content[0],&header_,256*sizeof(char)); if (MatchContent(header_content) == true) { - LOGN_DEBUG("mrc io: importing new style format"); + LOG_DEBUG("mrc io: importing new style format"); detail::import_endianess_switcher<detail::ccp4_header>(sh,loc,head_str,formatmrc); } else { - LOGN_DEBUG("mrc io: importing old style format"); + LOG_DEBUG("mrc io: importing old style format"); detail::import_endianess_switcher<detail::mrc_header>(sh,loc,head_str,formatmrc); } } @@ -985,10 +985,10 @@ void MapIOMrcHandler::Export(const img::MapHandle& sh, std::ostream& loc,const I assert (formatstruct.GetFormatString()==UndefinedImageFormat::FORMAT_STRING); } if (formatmrc.GetSubformat()==MRC_OLD_FORMAT) { - LOGN_DEBUG("mrc io: exporting old style format"); + LOG_DEBUG("mrc io: exporting old style format"); detail::export_endianess_switcher<detail::mrc_header>(sh,loc,formatmrc); } else { - LOGN_DEBUG("mrc io: exporting new style format"); + LOG_DEBUG("mrc io: exporting new style format"); detail::export_endianess_switcher<detail::ccp4_header>(sh,loc,formatmrc); } } diff --git a/modules/io/src/img/map_io_nanoscope_handler.cc b/modules/io/src/img/map_io_nanoscope_handler.cc index 4571d7574..a18a25c56 100644 --- a/modules/io/src/img/map_io_nanoscope_handler.cc +++ b/modules/io/src/img/map_io_nanoscope_handler.cc @@ -179,17 +179,17 @@ void header_filler(NHeader& h, std::istream& in, int inum) void print_header (const NHeader& header, int inum) { if(Logger::Instance().GetLogLevel()>2) { - LOG_MESSAGE("io_nanoscope: header dump for image " << inum << std::endl); - LOG_MESSAGE(" px : " << header.px << std::endl); - LOG_MESSAGE(" py : " << header.py << std::endl); - LOG_MESSAGE(" nmsize : " << header.nmsize << std::endl); - LOG_MESSAGE(" sampling: " << header.sampling << " nm" << std::endl); - LOG_MESSAGE(" zscale : " << header.zscale << std::endl); - LOG_MESSAGE(" multih : " << header.multih << std::endl); - LOG_MESSAGE(" multid : " << header.multid << std::endl); - LOG_MESSAGE(" multi : " << header.multi << std::endl); - LOG_MESSAGE(" doffset : " << header.doffset << std::endl); - LOG_MESSAGE(" dlength : " << header.dlength << std::endl); + LOG_INFO("io_nanoscope: header dump for image " << inum); + LOG_INFO(" px : " << header.px); + LOG_INFO(" py : " << header.py); + LOG_INFO(" nmsize : " << header.nmsize); + LOG_INFO(" sampling: " << header.sampling << " nm"); + LOG_INFO(" zscale : " << header.zscale); + LOG_INFO(" multih : " << header.multih); + LOG_INFO(" multid : " << header.multid); + LOG_INFO(" multi : " << header.multi); + LOG_INFO(" doffset : " << header.doffset); + LOG_INFO(" dlength : " << header.dlength); } } diff --git a/modules/io/src/img/map_io_situs_handler.cc b/modules/io/src/img/map_io_situs_handler.cc index 2be72859b..989c60d71 100644 --- a/modules/io/src/img/map_io_situs_handler.cc +++ b/modules/io/src/img/map_io_situs_handler.cc @@ -89,8 +89,8 @@ void print_header(const situs_header& h) s << "situs header: " << std::endl; s << format(" voxel width: %1") % h.dwidth << std::endl; s << format(" size x y z: %1 %2 %3") % h.extx % h.exty % h.extz << std::endl; - s << format(" origin x y z: %1 %2 %3") % h.gridx % h.gridy % h.gridz << std::endl; - LOG_MESSAGE(s.str()); + s << format(" origin x y z: %1 %2 %3") % h.gridx % h.gridy % h.gridz; + LOG_INFO(s.str()); } @@ -208,7 +208,7 @@ void MapIOSitusHandler::Import(img::MapHandle& mh, std::istream& infile,const Im mh.Reset(msize); mh.SetSpatialSampling(geom::Vec3(header.dwidth,header.dwidth,header.dwidth)); - LOG_VERBOSE("resulting image extent: " << mh.GetExtent() << std::endl); + LOG_VERBOSE("resulting image extent: " << mh.GetExtent()); detail::real_filler(infile,header,mh,1.0); diff --git a/modules/io/src/img/map_io_spi_handler.cc b/modules/io/src/img/map_io_spi_handler.cc index 9eaa89829..6b308f912 100644 --- a/modules/io/src/img/map_io_spi_handler.cc +++ b/modules/io/src/img/map_io_spi_handler.cc @@ -201,8 +201,8 @@ void print_header(const spider_header& h) s << format(" std dev: %1%") % h.fSig << std::endl; } s << format(" scale: %1%") % h.fScale << std::endl; - s << format(" header size: %1%") % h.fLabbyt << std::endl; - LOG_MESSAGE(s.str()); + s << format(" header size: %1%") % h.fLabbyt; + LOG_INFO(s.str()); } int determine_byte_order(std::istream& f) @@ -218,10 +218,10 @@ int determine_byte_order(std::istream& f) if (bs_iform<-22.0 ||bs_iform>3.0 ||static_cast<int>(bs_iform)==0) { throw(ost::io::IOException("error reading spider file (even tried byte-swapping")); } - LOG_VERBOSE("Spider IO: reading big endian data" << std::endl); + LOG_VERBOSE("Spider IO: reading big endian data"); return OST_BIG_ENDIAN; } - LOG_VERBOSE("Spider IO: reading little endian data" << std::endl); + LOG_VERBOSE("Spider IO: reading little endian data"); return OST_LITTLE_ENDIAN; } @@ -432,7 +432,7 @@ void MapIOSpiHandler::Import(img::MapHandle& mh, std::istream& infile,const Imag mh.Reset(msize); - LOG_MESSAGE("density map extent: " << mh.GetExtent() << std::endl); + LOG_INFO("density map extent: " << mh.GetExtent()); switch(detail::determine_byte_order(infile)){ @@ -449,7 +449,7 @@ void MapIOSpiHandler::Import(img::MapHandle& mh, std::istream& infile,const Imag if (header.fScale==0.0) { mh.SetSpatialSampling(geom::Vec3(1.0,1.0,1.0)); - LOG_MESSAGE("assuming 1 A spatial sampling" << std::endl); + LOG_INFO("assuming 1 A spatial sampling"); } else { Real fscale=static_cast<Real>(header.fScale); mh.SetSpatialSampling(geom::Vec3(fscale,fscale,fscale)); @@ -457,8 +457,8 @@ void MapIOSpiHandler::Import(img::MapHandle& mh, std::istream& infile,const Imag mh.SetAbsoluteOrigin(geom::Vec3(0,0,0)); - LOG_MESSAGE("assuming origin at the first voxel" << std::endl); - LOG_MESSAGE("assuming absolute origin at (0,0,0)" << std::endl); + LOG_INFO("assuming origin at the first voxel"); + LOG_INFO("assuming absolute origin at (0,0,0)"); } diff --git a/modules/io/src/img/map_io_tiff_handler.cc b/modules/io/src/img/map_io_tiff_handler.cc index 26305654b..a4c3fd191 100644 --- a/modules/io/src/img/map_io_tiff_handler.cc +++ b/modules/io/src/img/map_io_tiff_handler.cc @@ -134,7 +134,7 @@ void MapIOTiffHandler::Import(img::MapHandle& image, const boost::filesystem::pa assert (formatstruct.GetFormatString()==UndefinedImageFormat::FORMAT_STRING); } - LOG_VERBOSE("I/O Tiff: using library version " << TIFFGetVersion() << std::endl); + LOG_VERBOSE("I/O Tiff: using library version " << TIFFGetVersion()); detail::tiff_warning_handler_wrapper twhw; TIFF* tfile=open_subimage_file(location,formattif); load_image_data(tfile,image,formattif); @@ -151,7 +151,7 @@ void MapIOTiffHandler::Import(img::ImageHandle& image, std::istream& location, c assert (formatstruct.GetFormatString()==UndefinedImageFormat::FORMAT_STRING); } - LOG_VERBOSE("I/O Tiff: using library version " << TIFFGetVersion() << std::endl); + LOG_VERBOSE("I/O Tiff: using library version " << TIFFGetVersion()); detail::tiff_warning_handler_wrapper twhw; TIFF* tfile=open_subimage_stream(location,formattif); load_image_data(tfile,image,formattif); @@ -219,18 +219,18 @@ void MapIOTiffHandler::do_export(const img::MapHandle& image,TIFF* tfile,TIF& fo case OST_BIT32_FORMAT: case OST_DEFAULT_FORMAT: norm = img::alg::CreateLinearRangeNormalizer(image,formattif.GetMinimum(),formattif.GetMaximum()); - LOGN_VERBOSE("Autodetecting normalization for export: normalization on"); + LOG_VERBOSE("Autodetecting normalization for export: normalization on"); break; case OST_FLOAT_FORMAT: case OST_DOUBLE_FORMAT: - LOGN_VERBOSE("Autodetecting normalization for export: normalization off"); + LOG_VERBOSE("Autodetecting normalization for export: normalization off"); break; } } else if (formattif.GetNormalizeOnSave() == true) { - LOGN_VERBOSE("Normalization used for export."); + LOG_VERBOSE("Normalization used for export."); norm = img::alg::CreateLinearRangeNormalizer(image,formattif.GetMinimum(),formattif.GetMaximum()); } else { - LOGN_VERBOSE("No normalization used for export."); + LOG_VERBOSE("No normalization used for export."); } detail::tiff_warning_handler_wrapper twhw; @@ -440,9 +440,9 @@ TIFF* MapIOTiffHandler::open_subimage_file(const boost::filesystem::path& locati if(formattif.GetSubimage()!=-1){ directory_number=formattif.GetSubimage(); } - LOG_VERBOSE("I/O Tiff: using directory nr. " << directory_number<< std::endl); + LOG_VERBOSE("I/O Tiff: using directory nr. " << directory_number); const String& filename = location.string(); - LOG_VERBOSE("I/O Tiff: calling TIFFOpen with " << filename.c_str() << std::endl); + LOG_VERBOSE("I/O Tiff: calling TIFFOpen with " << filename.c_str()); TIFF* tfile=TIFFOpen(filename.c_str(),"r"); if(!tfile) { throw IOException("could not open " + filename + String(" for reading")); @@ -462,9 +462,9 @@ TIFF* MapIOTiffHandler::open_subimage_stream(std::istream& location,const TIF& f if(formattif.GetSubimage()!=-1){ directory_number=formattif.GetSubimage(); } - LOG_VERBOSE("I/O Tiff: using directory nr. " << directory_number<< std::endl); + LOG_VERBOSE("I/O Tiff: using directory nr. " << directory_number); const String& filename = "stream"; - LOG_VERBOSE("I/O Tiff: calling TIFFClientOpen with " << filename.c_str() << std::endl); + LOG_VERBOSE("I/O Tiff: calling TIFFClientOpen with " << filename.c_str()); TIFF* tfile=TIFFClientOpen(filename.c_str(), "rm", &location, @@ -508,7 +508,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co } TIFFGetField(tfile,TIFFTAG_ROWSPERSTRIP,&rps); - LOG_MESSAGE ("I/O Tiff: Header: " << width << "x" << height << " " << bpp << "bpp" << std::endl); + LOG_INFO("I/O Tiff: Header: " << width << "x" << height << " " << bpp << "bpp"); img::Extent image_extent(img::Point(0,0),img::Size(width,height)); @@ -531,19 +531,19 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co if(!TIFFGetField(tfile,TIFFTAG_SAMPLEFORMAT,&fmt)) { // todo check subtype - LOG_MESSAGE("I/O Tiff: Unknown sample format: assuming uint" << std::endl); + LOG_INFO("I/O Tiff: Unknown sample format: assuming uint"); fmt=SAMPLEFORMAT_UINT; } - LOG_MESSAGE("I/O Tiff: Header: spp=" << spp << "; rps=" << rps << "; plc=" << plc << "; ori=" << ori << std::endl); - LOG_MESSAGE("I/O Tiff: Header: pos= " << xpos << "," << ypos << "; reso= " << xreso << "," << yreso << ";" << std::endl); + LOG_INFO("I/O Tiff: Header: spp=" << spp << "; rps=" << rps << "; plc=" << plc << "; ori=" << ori); + LOG_INFO("I/O Tiff: Header: pos= " << xpos << "," << ypos << "; reso= " << xreso << "," << yreso << ";"); if(bpp!=8 && bpp!=16 && bpp!=32 && bpp!=64 && bpp!=128) { throw IOException("bits per sample must be 8, 16, 32, 64 or 128"); } if(spp==0) { - LOG_MESSAGE("I/O Tiff: Samples per pixel is zero, assuming one" << std::endl); + LOG_INFO("I/O Tiff: Samples per pixel is zero, assuming one"); spp=1; } @@ -551,7 +551,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co if(spp>4) { throw IOException("I/O Tiff: unexpected spp>4 in header"); } - LOG_MESSAGE("I/O Tiff: Samples per pixel>1, reading first channel only" << std::endl); + LOG_INFO("I/O Tiff: Samples per pixel>1, reading first channel only"); } if(TIFFIsTiled(tfile)) { @@ -563,12 +563,12 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co uint stripsize=TIFFStripSize(tfile); uint stripcount=TIFFNumberOfStrips(tfile); - LOG_MESSAGE("I/O Tiff: " << "found " << stripcount << " strips in tiff file" << std::endl); - LOG_MESSAGE("I/O Tiff: " << "allocating " << stripsize << " bytes for temporary read buffer" << std::endl); + LOG_INFO("I/O Tiff: " << "found " << stripcount << " strips in tiff file"); + LOG_INFO("I/O Tiff: " << "allocating " << stripsize << " bytes for temporary read buffer"); buf = _TIFFmalloc(stripsize); if(image.GetType()==img::WORD) { - LOG_MESSAGE("I/O Tiff: " << "reseting target image to WORD " << image_extent << std::endl); + LOG_INFO("I/O Tiff: " << "reseting target image to WORD " << image_extent); image.Reset(image_extent, img::WORD, img::SPATIAL); img::image_state::WordSpatialImageState *is = @@ -579,7 +579,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co int current_row = 0; - LOG_VERBOSE("I/O Tiff: " << "importing data" << std::endl); + LOG_VERBOSE("I/O Tiff: " << "importing data"); img::Progress::Instance().Register(this,stripcount,100); for (strip = 0; strip < stripcount; ++strip) { int cread=TIFFReadEncodedStrip(tfile, strip, buf, (tsize_t) -1); @@ -596,7 +596,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co } img::Progress::Instance().AdvanceProgress(this); } - LOG_VERBOSE("I/O Tiff: " << "done" << std::endl); + LOG_VERBOSE("I/O Tiff: " << "done"); img::Progress::Instance().DeRegister(this); uint16 photometric; if(TIFFGetField(tfile,TIFFTAG_PHOTOMETRIC,&photometric)){ @@ -615,14 +615,14 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co img::image_state::RealSpatialImageState *isr=0; img::image_state::ComplexSpatialImageState *isc=0; if(fmt==SAMPLEFORMAT_COMPLEXINT || fmt==SAMPLEFORMAT_COMPLEXIEEEFP){ - LOG_MESSAGE("I/O Tiff: " << "reseting target image to complex spatial " << image_extent << std::endl); + LOG_INFO("I/O Tiff: " << "reseting target image to complex spatial " << image_extent); image.Reset(image_extent,img::COMPLEX,img::SPATIAL); isc = dynamic_cast<img::image_state::ComplexSpatialImageState*>(image.ImageStatePtr().get()); if(!isc) { throw IOException("unexpected failure of dynamic_cast in tiff io"); } }else{ - LOG_MESSAGE("I/O Tiff: " << "reseting target image to Real img::SPATIAL" << image_extent << std::endl); + LOG_INFO("I/O Tiff: " << "reseting target image to Real img::SPATIAL" << image_extent); image.Reset(image_extent, img::REAL, img::SPATIAL); isr= dynamic_cast<img::image_state::RealSpatialImageState*>(image.ImageStatePtr().get()); @@ -634,7 +634,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co int current_row = 0; - LOG_VERBOSE("I/O Tiff: " << "importing data" << std::endl); + LOG_VERBOSE("I/O Tiff: " << "importing data"); img::Progress::Instance().Register(this,stripcount,100); for (strip = 0; strip < stripcount; ++strip) { int cread=TIFFReadEncodedStrip(tfile, strip, buf, (tsize_t) -1); @@ -704,7 +704,7 @@ void MapIOTiffHandler::load_image_data(TIFF* tfile, img::ImageHandle& image, co } img::Progress::Instance().AdvanceProgress(this); } - LOG_VERBOSE("I/O Tiff: " << "done" << std::endl); + LOG_VERBOSE("I/O Tiff: " << "done"); img::Progress::Instance().DeRegister(this); uint16 photometric; diff --git a/modules/io/src/img/tiff_util.cc b/modules/io/src/img/tiff_util.cc index 37f8c3226..0fa8e3186 100644 --- a/modules/io/src/img/tiff_util.cc +++ b/modules/io/src/img/tiff_util.cc @@ -19,7 +19,6 @@ //------------------------------------------------------------------------------ #include <stdarg.h> -#include <sstream> #include <cassert> #include <complex> #include <ost/log.hh> @@ -39,10 +38,7 @@ void tiff_warning_handler(const char *mod, const char* fmt, va_list ap) #else snprintf(message,1024,fmt,ap); #endif - String msg; - std::stringstream msgs(msg); - msgs << mod << ": " << message << std::endl; - LOG_MESSAGE(msg); + LOG_INFO(mod << ": " << message); } int32_t CustomTIFFReadProcIStream(void* thandle, void* tdata, int32_t tsize) diff --git a/modules/io/src/mol/dcd_io.cc b/modules/io/src/mol/dcd_io.cc index 778e86ce4..177cd57af 100644 --- a/modules/io/src/mol/dcd_io.cc +++ b/modules/io/src/mol/dcd_io.cc @@ -84,7 +84,7 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist2, char dummy[4]; bool swap_flag=false; - LOGN_MESSAGE("importing trajectory data"); + LOG_INFO("importing trajectory data"); if(gap_flag) ff.read(dummy,sizeof(dummy)); ff.read(header.hdrr,sizeof(char)*4); @@ -95,7 +95,7 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist2, if(header.icntrl[1]<0 || header.icntrl[1]>1e8) { throw(IOException("LoadCHARMMTraj: nonsense atom count in header")); } else { - LOGN_MESSAGE("LoadCHARMMTraj: byte-swapping"); + LOG_INFO("LoadCHARMMTraj: byte-swapping"); swap_flag=true; } } @@ -105,13 +105,13 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist2, if(header.icntrl[19]!=0) { // CHARMM format skip_flag=(header.icntrl[10]!=0); if(skip_flag) { - LOGN_VERBOSE("LoadCHARMMTraj: using CHARMM format with per-frame header"); + LOG_VERBOSE("LoadCHARMMTraj: using CHARMM format with per-frame header"); } else { - LOGN_VERBOSE("LoadCHARMMTraj: using CHARMM format"); + LOG_VERBOSE("LoadCHARMMTraj: using CHARMM format"); } } else { // XPLOR format - LOGN_VERBOSE("LoadCHARMMTraj: using XPLOR format"); + LOG_VERBOSE("LoadCHARMMTraj: using XPLOR format"); } if(gap_flag) ff.read(dummy,sizeof(dummy)); @@ -131,12 +131,12 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist2, header.f_atom_count=header.icntrl[8]; header.atom_count=header.t_atom_count-header.f_atom_count; - LOGN_DEBUG("LoadCHARMMTraj: " << header.num << " trajectories with " + LOG_DEBUG("LoadCHARMMTraj: " << header.num << " trajectories with " << header.atom_count << " atoms (" << header.f_atom_count << " fixed) each"); if(alist.size() != static_cast<size_t>(header.t_atom_count)) { - LOGN_ERROR("LoadCHARMMTraj: atom count missmatch: " << alist.size() + LOG_ERROR("LoadCHARMMTraj: atom count missmatch: " << alist.size() << " in coordinate file, " << header.t_atom_count << " in each traj frame"); throw(IOException("invalid trajectory")); @@ -161,7 +161,7 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist2, // read each frame if(!ff) { /* premature EOF */ - LOGN_ERROR("LoadCHARMMTraj: premature end of file, " << i + LOG_ERROR("LoadCHARMMTraj: premature end of file, " << i << " frames read"); break; } @@ -200,11 +200,11 @@ mol::CoordGroupHandle load_dcd(const mol::AtomHandleList& alist2, ff.get(); if(!ff.eof()) { - LOGN_VERBOSE("LoadCHARMMTraj: unexpected trailing file data, bytes read: " + LOG_VERBOSE("LoadCHARMMTraj: unexpected trailing file data, bytes read: " << ff.tellg()); } - LOGN_VERBOSE("Loaded " << cg.GetFrameCount() << " frames with " << cg.GetAtomCount() << " atoms each"); + LOG_VERBOSE("Loaded " << cg.GetFrameCount() << " frames with " << cg.GetAtomCount() << " atoms each"); return cg; } diff --git a/modules/io/src/mol/entity_io_crd_handler.cc b/modules/io/src/mol/entity_io_crd_handler.cc index 1b093be94..320db5d1d 100644 --- a/modules/io/src/mol/entity_io_crd_handler.cc +++ b/modules/io/src/mol/entity_io_crd_handler.cc @@ -81,7 +81,7 @@ void CRDReader::Import(mol::EntityHandle& ent) while(std::getline(in_,line)) { ParseAndAddAtom(line,ent); } - LOGN_MESSAGE("imported " << chain_count_ << " chains, " << residue_count_ + LOG_INFO("imported " << chain_count_ << " chains, " << residue_count_ << " residues, " << atom_count_ << " atoms"); } @@ -89,7 +89,7 @@ void CRDReader::ParseAndAddAtom(const String& line, mol::EntityHandle& ent) { mol::XCSEditor editor=ent.RequestXCSEditor(mol::BUFFERED_EDIT); - LOGN_TRACE( "line: [" << line << "]" ); + LOG_TRACE( "line: [" << line << "]" ); //int anum = boost::lexical_cast<int>(boost::trim_copy(line.substr(0,5))); String aname = boost::trim_copy(line.substr(16,4)); @@ -104,7 +104,7 @@ void CRDReader::ParseAndAddAtom(const String& line, mol::EntityHandle& ent) mol::ResidueKey rkey(rname); // some postprocessing - LOGN_TRACE( "s_chain: [" << s_chain << "]" ); + LOG_TRACE( "s_chain: [" << s_chain << "]" ); mol::ResNum rnum(irnum); @@ -127,21 +127,21 @@ void CRDReader::ParseAndAddAtom(const String& line, mol::EntityHandle& ent) if(update_chain) { if (!(curr_chain_=ent.FindChain(s_chain))) { - LOGN_DUMP("new chain " << s_chain); + LOG_DEBUG("new chain " << s_chain); curr_chain_=editor.InsertChain(s_chain); ++chain_count_; } } if(update_residue) { - LOGN_DUMP("new residue " << rkey << " " << rnum); + LOG_DEBUG("new residue " << rkey << " " << rnum); curr_residue_=editor.AppendResidue(curr_chain_, rkey, rnum); assert(curr_residue_.IsValid()); ++residue_count_; } // finally add atom - LOGN_DUMP("adding atom " << aname << " (" << ele << ") @" << apos); + LOG_DEBUG("adding atom " << aname << " (" << ele << ") @" << apos); mol::AtomProp aprop; aprop.element=ele; aprop.radius=conop::Conopology::Instance().GetDefaultAtomRadius(ele); diff --git a/modules/io/src/mol/entity_io_mae_handler.cc b/modules/io/src/mol/entity_io_mae_handler.cc index d002a7120..e810c9089 100644 --- a/modules/io/src/mol/entity_io_mae_handler.cc +++ b/modules/io/src/mol/entity_io_mae_handler.cc @@ -127,16 +127,16 @@ void MAEReader::Import(mol::EntityHandle& ent) if(in_atom_block) { if(parsing_atoms) { if(boost::regex_match(line,r_delim)) { - LOGN_DUMP( "stopping atom parsing" ); + LOG_DEBUG( "stopping atom parsing" ); parsing_atoms=false; prop_list.clear(); } else { // parsing atom line std::vector<std::string> tokens=tokenize(line); for(size_t i=0;i<tokens.size();++i) { - LOG_DUMP( "[" << tokens[i] << "] "); + LOG_DEBUG( "[" << tokens[i] << "] "); } - LOGN_DUMP(""); + LOG_DEBUG(""); add_atom(ent,editor, tokens[i_atom_name], tokens[i_atom_xpos], @@ -157,17 +157,17 @@ void MAEReader::Import(mol::EntityHandle& ent) i_chain_name==-1) { throw IOException("missing atom prop"); } - LOGN_DUMP( "starting atom parsing" ); + LOG_DEBUG( "starting atom parsing" ); parsing_atoms=true; } else if(line[0]=='}') { - LOGN_DUMP( "exiting atom block" ); + LOG_DEBUG( "exiting atom block" ); in_atom_block=false; } else { // parsing property line if(line[0]!='#') { int pid=prop_list.size()+1; prop_list.push_back(line); - LOGN_DUMP( "found property '" << prop_list.back() << "' id=" << pid ); + LOG_DEBUG( "found property '" << prop_list.back() << "' id=" << pid ); if(line=="s_m_pdb_atom_name") i_atom_name=pid; else if(line=="r_m_x_coord") i_atom_xpos=pid; else if(line=="r_m_y_coord") i_atom_ypos=pid; @@ -180,22 +180,22 @@ void MAEReader::Import(mol::EntityHandle& ent) } } else { // not in atom block if(boost::regex_match(line,r_atom_block)) { - LOGN_DUMP( "entering atom block" ); + LOG_DEBUG( "entering atom block" ); in_atom_block=true; } else if(line[0]=='}') { - LOGN_DUMP( "exiting ct block" ); + LOG_DEBUG( "exiting ct block" ); in_ct_block=false; } } } else { // not in ct block if(boost::regex_match(line,r_ct_block)) { - LOGN_DUMP( "entering ct block" ); + LOG_DEBUG( "entering ct block" ); in_ct_block=true; } } } - LOGN_MESSAGE("imported " << chain_count_ << " chains, " << residue_count_ + LOG_INFO("imported " << chain_count_ << " chains, " << residue_count_ << " residues, " << atom_count_ << " atoms"); } @@ -245,10 +245,10 @@ void MAEReader::add_atom(mol::EntityHandle ent, if(update_chain) { if (!(curr_chain_=ent.FindChain(cname))) { curr_chain_=editor.InsertChain(cname); - LOGN_DUMP("new chain " << curr_chain_); + LOG_DEBUG("new chain " << curr_chain_); ++chain_count_; } else { - LOGN_DUMP("old chain " << curr_chain_); + LOG_DEBUG("old chain " << curr_chain_); } } @@ -256,15 +256,15 @@ void MAEReader::add_atom(mol::EntityHandle ent, if (!(curr_residue_=curr_chain_.FindResidue(rnum))) { curr_residue_=editor.AppendResidue(curr_chain_, rkey, rnum); assert(curr_residue_.IsValid()); - LOGN_DUMP(" new residue " << curr_residue_); + LOG_DEBUG(" new residue " << curr_residue_); ++residue_count_; } else { - LOGN_DUMP(" old residue " << curr_residue_); + LOG_DEBUG(" old residue " << curr_residue_); } } // finally add atom - LOGN_DUMP(" atom " << aname << " (" << ele << ") @" << apos); + LOG_DEBUG(" atom " << aname << " (" << ele << ") @" << apos); mol::AtomProp aprop; aprop.element=ele; aprop.radius=conop::Conopology::Instance().GetDefaultAtomRadius(ele); diff --git a/modules/io/src/mol/load_entity.cc b/modules/io/src/mol/load_entity.cc index 22d0aa933..4eda99b4a 100644 --- a/modules/io/src/mol/load_entity.cc +++ b/modules/io/src/mol/load_entity.cc @@ -32,12 +32,12 @@ namespace { void Import(mol::EntityHandle& eh, const String& filename, int flag) { Profile profile_import("import"); - LOG_DUMP("creating EntityIOHandle for " << filename << std::endl); + LOG_DEBUG("creating EntityIOHandle for " << filename); EntityIOHandlerP ent_io = IOManager::Instance().FindEntityImportHandler(filename); // TODO: proper error handling - LOG_DUMP("calling import on entity io handle" << std::endl); + LOG_DEBUG("calling import on entity io handle"); /* This should probably allow various parameters to be passed to adjust the loading behaviour for a particular filter. @@ -46,7 +46,7 @@ void Import(mol::EntityHandle& eh, const String& filename, int flag) */ ent_io->Import(eh,filename); - LOG_DUMP("running conopology" << std::endl); + LOG_DEBUG("running conopology"); if(ent_io->RequiresBuilder()) { conop::BuilderP builder = conop::Conopology::Instance().GetBuilder(); @@ -58,9 +58,7 @@ void Import(mol::EntityHandle& eh, const String& filename, int flag) mol::EntityHandle LoadEntity(const String& filename, int flag) { - LOG_DEBUG("entering LoadEntity (unmanaged)" << std::endl); - - LOG_DUMP("creating emtpy entity" << std::endl); + LOG_DEBUG("creating emtpy entity"); mol::EntityHandle eh=mol::CreateEntity(); mol::XCSEditor xcs_lock=eh.RequestXCSEditor(mol::BUFFERED_EDIT); Import(eh,filename,flag); diff --git a/modules/io/src/mol/load_surface.cc b/modules/io/src/mol/load_surface.cc index 964ff48b4..e3f94f754 100644 --- a/modules/io/src/mol/load_surface.cc +++ b/modules/io/src/mol/load_surface.cc @@ -29,10 +29,9 @@ namespace { void ImportSurface(mol::SurfaceHandle& sh, const String& fname, const String& type) { - LOG_DUMP("creating EntityIOHandle for " << fname << std::endl); + LOG_DEBUG("creating EntityIOHandle for " << fname); SurfaceIOHandlerPtr surf_io = IOManager::Instance().FindSurfaceImportHandler(fname,type); - - LOG_DUMP("calling import on surface io handle" << std::endl); + LOG_DEBUG("calling import on surface io handle"); surf_io->Import(sh,fname); } diff --git a/modules/io/src/mol/pdb_reader.cc b/modules/io/src/mol/pdb_reader.cc index 984b4bef5..8ed929e08 100644 --- a/modules/io/src/mol/pdb_reader.cc +++ b/modules/io/src/mol/pdb_reader.cc @@ -126,7 +126,7 @@ bool PDBReader::HasNext() void PDBReader::Import(mol::EntityHandle& ent, const String& restrict_chains) { - LOGN_DEBUG("PDBReader: current flags: " << PDB::Flags()); + LOG_DEBUG("PDBReader: current flags: " << PDB::Flags()); Profile profile_import("PDBReader::Import"); this->ClearState(); @@ -145,11 +145,11 @@ void PDBReader::Import(mol::EntityHandle& ent, continue; } if (IEquals(curr_line.substr(0, 6), StringRef("ATOM ", 6))) { - LOGN_TRACE("processing ATOM entry"); + LOG_TRACE("processing ATOM entry"); this->ParseAndAddAtom(curr_line, line_num_, ent, StringRef("ATOM", 4)); } else if (IEquals(curr_line.substr(0, 6), StringRef("ANISOU", 6))) { - LOGN_TRACE("processing ANISOU entry"); + LOG_TRACE("processing ANISOU entry"); this->ParseAnisou(curr_line, line_num_, ent); } break; @@ -179,7 +179,7 @@ void PDBReader::Import(mol::EntityHandle& ent, if (IEquals(curr_line.substr(0, 6), StringRef("HETATM", 6))) { if (PDB::Flags() & PDB::NO_HETATMS) continue; - LOGN_TRACE("processing HETATM entry"); + LOG_TRACE("processing HETATM entry"); this->ParseAndAddAtom(curr_line, line_num_, ent, StringRef("HETATM", 6)); } else if (IEquals(curr_line.substr(0, 6), StringRef("HELIX ", 6))) { @@ -218,7 +218,7 @@ void PDBReader::Import(mol::EntityHandle& ent, break; } } while (std::getline(in_, curr_line_) && ++line_num_ && go_on); - LOGN_MESSAGE("imported " + LOG_INFO("imported " << chain_count_ << " chains, " << residue_count_ << " residues, " << atom_count_ << " atoms; with " @@ -235,7 +235,7 @@ void PDBReader::AssignSecStructure(mol::EntityHandle ent) i!=e; ++i) { mol::ChainHandle chain=ent.FindChain(i->chain); if (!chain.IsValid()) { - LOGN_MESSAGE("ignoring helix record for unknown chain "+i->chain); + LOG_INFO("ignoring helix record for unknown chain "+i->chain); continue; } mol::SecStructure alpha(mol::SecStructure::ALPHA_HELIX); @@ -254,7 +254,7 @@ void PDBReader::AssignSecStructure(mol::EntityHandle ent) i!=e; ++i) { mol::ChainHandle chain=ent.FindChain(i->chain); if (!chain.IsValid()) { - LOGN_MESSAGE("ignoring strand record for unknown chain "+i->chain); + LOG_INFO("ignoring strand record for unknown chain "+i->chain); continue; } mol::SecStructure extended(mol::SecStructure::EXTENDED); @@ -438,7 +438,7 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num, temp=line.substr(60, 6).ltrim().to_float(); } } - LOGN_TRACE( "line: [" << line << "]" ); + LOG_TRACE( "line: [" << line << "]" ); String s_ele; String s_chain(1, chain_name); String aname(atom_name.str()); @@ -466,7 +466,7 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num, } // some postprocessing - LOGN_TRACE( "s_chain: [" << chain_name << "]" ); + LOG_TRACE( "s_chain: [" << chain_name << "]" ); // determine chain and residue update bool update_chain=false; @@ -496,7 +496,7 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num, curr_chain_=ent.FindChain(s_chain); #endif if(!curr_chain_.IsValid()) { - LOGN_DUMP("new chain " << s_chain); + LOG_DEBUG("new chain " << s_chain); curr_chain_=editor.InsertChain(s_chain); ++chain_count_; } @@ -508,14 +508,14 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num, curr_residue_=curr_chain_.FindResidue(res_num); } if (!curr_residue_.IsValid()) { - LOGN_DUMP("new residue " << res_name << " " << res_num); + LOG_DEBUG("new residue " << res_name << " " << res_num); curr_residue_=editor.AppendResidue(curr_chain_, res_name.str(), res_num); ++residue_count_; } assert(curr_residue_.IsValid()); } // finally add atom - LOGN_DUMP("adding atom " << aname << " (" << s_ele << ") @" << apos); + LOG_DEBUG("adding atom " << aname << " (" << s_ele << ") @" << apos); mol::AtomProp aprop; aprop.element=s_ele; if(is_pqr_) { @@ -547,7 +547,7 @@ void PDBReader::ParseAndAddAtom(const StringRef& line, int line_num, try { editor.AddAltAtomPos(String(1, alt_loc), me, apos); } catch (Error) { - LOGN_MESSAGE("Ignoring atom alt location since there is already an atom " + LOG_INFO("Ignoring atom alt location since there is already an atom " "with name " << aname << ", but without an alt loc"); return; } @@ -587,7 +587,7 @@ void PDBReader::ParseHelixEntry(const StringRef& line) } throw IOException(str(format("invalid helix entry on line %d") % line_num_)); } - LOGN_DEBUG("making helix entry: " << start_num.second << ", " + LOG_DEBUG("making helix entry: " << start_num.second << ", " << line[25] << " " << end_num.second << " " << line[37]); HSEntry hse = {to_res_num(start_num.second, line[25]), to_res_num(end_num.second, line[37]), @@ -612,7 +612,7 @@ void PDBReader::ParseStrandEntry(const StringRef& line) } throw IOException(str(format("invalid strand entry on line %d")%line_num_)); } - LOGN_DEBUG("making strand entry: " << start_num.second << ", " << line[26] + LOG_DEBUG("making strand entry: " << start_num.second << ", " << line[26] << " " << end_num.second << " " << line[37]); HSEntry hse = {to_res_num(start_num.second, line[26]), to_res_num(end_num.second, line[37]), diff --git a/modules/io/src/mol/save_entity.cc b/modules/io/src/mol/save_entity.cc index 0bfadfc0b..2a7a64ef2 100644 --- a/modules/io/src/mol/save_entity.cc +++ b/modules/io/src/mol/save_entity.cc @@ -31,7 +31,7 @@ void DLLEXPORT_OST_IO SaveEntity(const mol::EntityHandle& en, void DLLEXPORT_OST_IO SaveEntity(const mol::EntityView& en, const String& filename, const String& format) { - LOG_DUMP("creating EntityIOHandle for " << filename << std::endl); + LOG_DEBUG("creating EntityIOHandle for " << filename); IOManager& manager=IOManager::Instance(); EntityIOHandlerP ent_io=manager.FindEntityExportHandler(filename, format); @@ -39,7 +39,7 @@ void DLLEXPORT_OST_IO SaveEntity(const mol::EntityView& en, throw IOUnknownFormatException("No IO handler for file='"+filename+"', format='"+ format+"' found."); } - LOG_DUMP("calling export on entity io handle" << std::endl); + LOG_DEBUG("calling export on entity io handle"); ent_io->Export(en, filename); } diff --git a/modules/io/src/mol/sdf_reader.cc b/modules/io/src/mol/sdf_reader.cc index e2f0fabd2..4427850ea 100644 --- a/modules/io/src/mol/sdf_reader.cc +++ b/modules/io/src/mol/sdf_reader.cc @@ -82,12 +82,12 @@ void SDFReader::Import(mol::EntityHandle& ent) } curr_chain_.SetStringProp(data_header, data_value); } else if (boost::iequals(line, "$$$$")) { - LOGN_MESSAGE("MOLECULE " << curr_chain_.GetName() << " (" << chain_count_ << ") added.") + LOG_INFO("MOLECULE " << curr_chain_.GetName() << " (" << chain_count_ << ") added.") NextMolecule(); } } - LOGN_MESSAGE("imported " << chain_count_ << " chains, " << residue_count_ + LOG_INFO("imported " << chain_count_ << " chains, " << residue_count_ << " residues, " << atom_count_ << " atoms"); } @@ -113,7 +113,7 @@ void SDFReader::NextMolecule() void SDFReader::ParseAndAddHeader(const String& line, int line_num, mol::EntityHandle& ent, mol::XCSEditor& editor) { - LOGN_TRACE( "line: [" << line << "]" ); + LOG_TRACE( "line: [" << line << "]" ); format chain_fmter("%05i_%s"); switch(line_num) { @@ -129,12 +129,12 @@ void SDFReader::ParseAndAddHeader(const String& line, int line_num, throw IOException(str(format(msg) % line_num)); } curr_chain_=editor.InsertChain(s_chain); - LOGN_DUMP("new chain " << s_chain); + LOG_DEBUG("new chain " << s_chain); mol::ResidueKey rkey=boost::trim_copy(s_title); mol::ResNum rnum(++residue_count_); curr_residue_=editor.AppendResidue(curr_chain_, rkey, rnum); - LOGN_DUMP("new residue " << rkey << "(" << rnum << ")"); + LOG_DEBUG("new residue " << rkey << "(" << rnum << ")"); break; } case 2: // user information line @@ -169,7 +169,7 @@ void SDFReader::ParseAndAddAtom(const String& line, int line_num, mol::XCSEditor& editor) { - LOGN_TRACE( "line: [" << line << "]" ); + LOG_TRACE( "line: [" << line << "]" ); if(line.length()<48 || line.length()>69) { String msg="Bad atom line %d: Not correct number of characters on the" @@ -214,7 +214,7 @@ void SDFReader::ParseAndAddAtom(const String& line, int line_num, throw IOException(str(format(msg) % line_num % s_charge)); } - LOGN_DUMP("adding atom " << aname << " (" << s_ele << ") @" << apos); + LOG_DEBUG("adding atom " << aname << " (" << s_ele << ") @" << apos); editor.InsertAtom(curr_residue_, aname,apos,aprop); } @@ -224,7 +224,7 @@ void SDFReader::ParseAndAddBond(const String& line, int line_num, mol::EntityHandle& ent, mol::XCSEditor& editor) { - LOGN_TRACE( "line: [" << line << "]" ); + LOG_TRACE( "line: [" << line << "]" ); if(line.length()<18 || line.length()>21) { String msg="Bad bond line %d: Not correct number of characters on the" @@ -269,7 +269,7 @@ void SDFReader::ParseAndAddBond(const String& line, int line_num, throw IOException(str(format(msg) % line_num % first % second)); } - LOGN_DUMP("adding bond " << s_first_name << " " << s_second_name << " (" << s_type << ") "); + LOG_DEBUG("adding bond " << s_first_name << " " << s_second_name << " (" << s_type << ") "); } }} diff --git a/modules/io/src/mol/surface_io_msms_handler.cc b/modules/io/src/mol/surface_io_msms_handler.cc index 48659c099..1fe223454 100644 --- a/modules/io/src/mol/surface_io_msms_handler.cc +++ b/modules/io/src/mol/surface_io_msms_handler.cc @@ -42,16 +42,16 @@ std::pair<bf::path,bf::path> detect_files(const bf::path& loc) void SurfaceIOMSMSHandler::Import(mol::SurfaceHandle& sh, const bf::path& loc) { std::pair<bf::path,bf::path> pp = detect_files(loc); - LOGN_DEBUG("loading files " << pp.first.string() << " and " << pp.second.string()); + LOG_DEBUG("loading files " << pp.first.string() << " and " << pp.second.string()); std::ifstream fvert(pp.first.string().c_str()); if(!fvert) { - LOGN_ERROR("could not open " << pp.first.string()); + LOG_ERROR("could not open " << pp.first.string()); return; } std::ifstream fface(pp.second.string().c_str()); if(!fface) { - LOGN_ERROR("could not open " << pp.second.string()); + LOG_ERROR("could not open " << pp.second.string()); return; } @@ -100,7 +100,7 @@ void SurfaceIOMSMSHandler::Import(mol::SurfaceHandle& sh, const bf::path& loc) sh.AddTri(vertice_map[id1],vertice_map[id2],vertice_map[id3]); } - LOGN_MESSAGE("loaded " << vertice_count << " vertices and " << face_count << " faces"); + LOG_INFO("loaded " << vertice_count << " vertices and " << face_count << " faces"); } void SurfaceIOMSMSHandler::Export(const mol::SurfaceHandle& sh, diff --git a/modules/mol/base/pymod/bounds.hh b/modules/mol/base/pymod/bounds.hh index 9182f67ee..80010c15a 100644 --- a/modules/mol/base/pymod/bounds.hh +++ b/modules/mol/base/pymod/bounds.hh @@ -12,24 +12,24 @@ geom::Vec3 geom_center(const H& h) template <typename H> geom::Vec3 geom_size(const H& h) { - LOGN_MESSAGE("GetBoundarySize()/boundary_size is deprecated. Use bounds.size" - " instead") + WARN_DEPRECATED("GetBoundarySize()/boundary_size is deprecated. Use " + "bounds.size instead") return h.GetBounds().GetSize(); } template <typename H> geom::Vec3 geom_start(const H& h) { - LOGN_MESSAGE("GetGeometricStart()/geometric_start is deprecated. Use " - "bounds.min instead") + WARN_DEPRECATED("GetGeometricStart()/geometric_start is deprecated. Use " + "bounds.min instead") return h.GetBounds().GetMin(); } template <typename H> geom::Vec3 geom_end(const H& h) { - LOGN_MESSAGE("GetGeometricEnd()/geometric_end is deprecated. Use " - "bounds.max instead") + WARN_DEPRECATED("GetGeometricEnd()/geometric_end is deprecated. Use " + "bounds.max instead") return h.GetBounds().GetMax(); } diff --git a/modules/mol/base/src/coord_source.cc b/modules/mol/base/src/coord_source.cc index 0afa3597d..37d1fbd91 100644 --- a/modules/mol/base/src/coord_source.cc +++ b/modules/mol/base/src/coord_source.cc @@ -54,12 +54,12 @@ CoordSource::~CoordSource() void CoordSource::CopyFrame(uint frame_id) { if (atoms_.empty()) { - LOGN_DEBUG("atom list empty, ignored"); + LOG_DEBUG("atom list empty, ignored"); return; } CoordFramePtr frame=this->GetFrame(frame_id); if (!frame) { - LOGN_DEBUG("invalid frame given, ignored"); + LOG_DEBUG("invalid frame given, ignored"); return; } assert(frame->size()==atoms_.size()); diff --git a/modules/mol/base/src/impl/atom_impl.cc b/modules/mol/base/src/impl/atom_impl.cc index cb3ecf87a..698bc863f 100644 --- a/modules/mol/base/src/impl/atom_impl.cc +++ b/modules/mol/base/src/impl/atom_impl.cc @@ -65,7 +65,7 @@ void AtomImpl::AddSecondaryConnector(const ConnectorImplP& bp) void AtomImpl::Apply(EntityVisitor& v) { - LOG_TRACE("visitor @" << &v << " visiting atom impl @" << this << std::endl); + LOG_TRACE("visitor @" << &v << " visiting atom impl @" << this); v.VisitAtom(AtomHandle(shared_from_this())); } @@ -88,11 +88,11 @@ void AtomImpl::TraceDirectionality(FragmentImplP frag, ConnectorImplP conn, if (conn) { #if !defined(NDEBUG) if (conn->GetFirst()==shared_from_this()) { - LOGN_DUMP("dir:" << String(n,' ') << " atom " << res_.lock()->GetNumber() + LOG_TRACE("dir:" << String(n,' ') << " atom " << res_.lock()->GetNumber() << "." << GetName() << " [" << conn->GetSecond()->GetQualifiedName() << " ]"); } else { - LOGN_DUMP("dir:" << String(n,' ') << " atom " << res_.lock()->GetNumber() + LOG_TRACE("dir:" << String(n,' ') << " atom " << res_.lock()->GetNumber() << "." << GetName() << " [" << conn->GetFirst()->GetQualifiedName() << " ]"); } @@ -100,7 +100,7 @@ void AtomImpl::TraceDirectionality(FragmentImplP frag, ConnectorImplP conn, #endif } else { - LOGN_DUMP("dir:" << String(n,' ') << " atom " << res_.lock()->GetNumber() + LOG_TRACE("dir:" << String(n,' ') << " atom " << res_.lock()->GetNumber() << "." << GetName() << " [ ]"); } diff --git a/modules/mol/base/src/impl/chain_impl.cc b/modules/mol/base/src/impl/chain_impl.cc index 8b9d74876..1a2e0e137 100644 --- a/modules/mol/base/src/impl/chain_impl.cc +++ b/modules/mol/base/src/impl/chain_impl.cc @@ -184,7 +184,7 @@ ResidueImplPtr ChainImpl::AppendResidue(const ResidueKey& key, in_sequence_=false; } if (in_sequence_) { - LOGN_DUMP("appending residue " << num); + LOG_DEBUG("appending residue " << num); // update is only needed if we introduce a new gap. if (residue_list_.back()->GetNumber().GetNum()+1<num.GetNum()) { Shift s; @@ -269,7 +269,7 @@ const ResidueImplList& ChainImpl::GetResidueList() const void ChainImpl::Apply(EntityVisitor& v) { - LOGN_TRACE("visitor @" << &v << " visiting chain impl @" << this); + LOG_TRACE("visitor @" << &v << " visiting chain impl @" << this); if (v.VisitChain(ChainHandle(shared_from_this()))) { for (ResidueImplList::iterator it=residue_list_.begin(); it!=residue_list_.end();++it) { diff --git a/modules/mol/base/src/impl/connector_impl.cc b/modules/mol/base/src/impl/connector_impl.cc index 977eb888e..31d22f1e4 100644 --- a/modules/mol/base/src/impl/connector_impl.cc +++ b/modules/mol/base/src/impl/connector_impl.cc @@ -38,7 +38,7 @@ ConnectorImpl::ConnectorImpl(const EntityImplPtr& e, const AtomImplPtr& first, void ConnectorImpl::Apply(EntityVisitor& v) { - LOGN_TRACE("visitor @" << &v << " visiting bond impl @" << this); + LOG_TRACE("visitor @" << &v << " visiting bond impl @" << this); v.VisitBond(BondHandle(shared_from_this())); } @@ -53,7 +53,7 @@ namespace { geom::Mat3 find_rotation(const geom::Vec3& d) { // assume the vectors are already normalized if (std::abs(Real(1.0-Length(d)))>0.00001) { - LOGN_DEBUG("connector find_rotation() has faulty length: " << Length(d)); + LOG_DEBUG("connector find_rotation() has faulty length: " << Length(d)); assert(0 && "error is big"); } Real dot=d[2]; diff --git a/modules/mol/base/src/impl/dihedral.cc b/modules/mol/base/src/impl/dihedral.cc index b984834e3..ff484d4e6 100644 --- a/modules/mol/base/src/impl/dihedral.cc +++ b/modules/mol/base/src/impl/dihedral.cc @@ -119,7 +119,7 @@ void Dihedral::SetAngleICS(Real angle, bool update_other) { } // we operate under the assumption that conn2_->First and atom_1 are // connected and not conn2_->Second and atom1_. - LOGN_DEBUG("SetAngleICS: " << a1->GetQualifiedName() << " " + LOG_DEBUG("SetAngleICS: " << a1->GetQualifiedName() << " " << a2->GetQualifiedName() << " " << a3->GetQualifiedName() << " " << a4->GetQualifiedName()); assert(ConnectorExists(a1, conn2->GetFirst())); diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc index 47f13dcb7..f2e4a3a00 100644 --- a/modules/mol/base/src/impl/entity_impl.cc +++ b/modules/mol/base/src/impl/entity_impl.cc @@ -379,24 +379,24 @@ ConnectorImplP EntityImpl::Connect(const AtomImplPtr& first, // check for already existing connection if(first->GetPrimaryConnector() && first->GetPrimaryConnector()->GetFirst()==second) { - LOGN_DUMP("connect: returning existing bond (1)"); + LOG_DEBUG("connect: returning existing bond (1)"); return first->GetPrimaryConnector(); } else if(second->GetPrimaryConnector() && second->GetPrimaryConnector()->GetFirst()==first) { - LOGN_DUMP("connect: returning existing bond (2)"); + LOG_DEBUG("connect: returning existing bond (2)"); return second->GetPrimaryConnector(); } else { ConnectorImplList clist = first->GetSecondaryConnectors(); for(ConnectorImplList::const_iterator it=clist.begin();it!=clist.end();++it) { if((*it)->GetSecond()==second) { - LOGN_DUMP("connect: returning existing bond (3)"); + LOG_DEBUG("connect: returning existing bond (3)"); return *it; } } clist = second->GetSecondaryConnectors(); for(ConnectorImplList::const_iterator it=clist.begin();it!=clist.end();++it) { if((*it)->GetSecond()==first) { - LOGN_DUMP("connect: returning existing bond (4)"); + LOG_DEBUG("connect: returning existing bond (4)"); return *it; } } @@ -416,7 +416,7 @@ ConnectorImplP EntityImpl::Connect(const AtomImplPtr& first, first->AddSecondaryConnector(bp); second->AddSecondaryConnector(bp); - LOG_DUMP("adding new connector " << bp << std::endl); + LOG_DEBUG("adding new connector " << bp); connector_map_.insert(ConnectorImplMap::value_type(bp.get(),bp)); return bp; } @@ -589,7 +589,7 @@ void EntityImpl::TraceDirectionality() for(AtomImplMap::iterator it=atom_map_.begin();it!=atom_map_.end();++it) { if (!it->second->IsVisited() && !it->second->HasPrevious()) { it->second->SetVisited(true); - LOGN_DUMP("dir: new fragment"); + LOG_DEBUG("dir: new fragment"); #if MAKE_SHARED_AVAILABLE FragmentImplP frag=boost::make_shared<FragmentImpl>(it->second); #else @@ -601,7 +601,7 @@ void EntityImpl::TraceDirectionality() } } if(traced_atom_count<atom_map_.size()) { - LOGN_DUMP("entering closed loops search, since only " << traced_atom_count + LOG_DEBUG("entering closed loops search, since only " << traced_atom_count << " from " << atom_map_.size() << " atoms were traced"); /* identify closed loops that prohibit @@ -628,7 +628,7 @@ void EntityImpl::TraceDirectionality() } } } - LOGN_DUMP("found pair [" << aip1 << "] [" << aip2 << "]"); + LOG_DEBUG("found pair [" << aip1 << "] [" << aip2 << "]"); // step 2: swap all connectors pointing to aip2 // thus removing its 'visited' state for(ConnectorImplMap::iterator it=connector_map_.begin(); @@ -648,12 +648,12 @@ void EntityImpl::TraceDirectionality() // infinite loop safeguard if(traced_atom_count == traced_atom_count_prev) { - LOGN_VERBOSE("Encountered unbreakable locked state during directionality trace"); + LOG_VERBOSE("Encountered unbreakable locked state during directionality trace"); break; } traced_atom_count_prev=traced_atom_count; } - LOGN_VERBOSE("Directionality trace completed with " << fragment_list_.size() + LOG_VERBOSE("Directionality trace completed with " << fragment_list_.size() << " fragment(s)"); } @@ -664,7 +664,7 @@ bool EntityImpl::IsXCSDirty() const void EntityImpl::UpdateFromICS() { - LOG_DEBUG("updating external from internal coordinate system" << std::endl); + LOG_DEBUG("updating external from internal coordinate system"); Profile prof_conv("update external from internal coordinate system"); // traverse through all atoms for(AtomImplMap::iterator it=atom_map_.begin();it!=atom_map_.end();++it) { @@ -673,7 +673,7 @@ void EntityImpl::UpdateFromICS() for (FragmentImplList::iterator it=fragment_list_.begin(); it!=fragment_list_.end();++it) { - LOG_DUMP("entering root of tree for ICS update" << std::endl;); + LOG_DEBUG("entering root of tree for ICS update"); assert(*it); AtomImplPtr ap=(*it)->GetAtom(); // recursive update, using position of first atom @@ -681,10 +681,10 @@ void EntityImpl::UpdateFromICS() pmat=tmat*pmat; ap->SetICSMat(pmat);*/ ap->UpdateFromICS(); - LOG_DUMP("done with tree traversal for ICS update" << std::endl;); + LOG_DEBUG("done with tree traversal for ICS update"); } - LOG_DEBUG("refreshing all connector positions" << std::endl;); + LOG_DEBUG("refreshing all connector positions"); // refresh all connector positions /* for (ConnectorImplMap::iterator it=connector_map_.begin(); @@ -697,23 +697,23 @@ void EntityImpl::UpdateFromICS() void EntityImpl::UpdateFromXCS() { - LOGN_DEBUG("rebuilding internal from external coordinate system"); + LOG_DEBUG("rebuilding internal from external coordinate system"); Profile prof_conv("updating internal from external coordinate system"); if(fragment_list_.empty()) { // this should have been handled by conopology after the // initial connectivity assignments - if not, then do it here Profile profile_trace("finished directionality trace"); - LOGN_DEBUG("warning: no fragment list, re-running directionality trace"); + LOG_DEBUG("warning: no fragment list, re-running directionality trace"); TraceDirectionality(); } - if(Logger::Instance().GetLogLevel()>=Logger::DUMP) { - LOGN_DUMP("dumping directionality"); + if(Logger::Instance().GetLogLevel()>Logger::DEBUG) { + LOG_TRACE("dumping directionality"); for(AtomImplMap::iterator it=atom_map_.begin();it!=atom_map_.end();++it) { - LOGN_DUMP(" " << it->second << ":"); + LOG_TRACE(" " << it->second << ":"); ConnectorImplList clist = it->second->GetSecondaryConnectors(); for(ConnectorImplList::const_iterator cit=clist.begin();cit!=clist.end();++cit) { - LOGN_DUMP(" " << (*cit)->GetFirst() << " -> " << (*cit)->GetSecond()); + LOG_TRACE(" " << (*cit)->GetFirst() << " -> " << (*cit)->GetSecond()); } } } @@ -725,7 +725,7 @@ void EntityImpl::UpdateFromXCS() for (FragmentImplList::iterator it=fragment_list_.begin(); it!=fragment_list_.end();++it) { - LOGN_DUMP("entering fragment tree traversal for XCS update"); + LOG_DEBUG("entering fragment tree traversal for XCS update"); FragmentImplP frag= *it; AtomImplPtr atom = frag->GetAtom(); { @@ -736,7 +736,7 @@ void EntityImpl::UpdateFromXCS() void EntityImpl::Apply(EntityVisitor& v) { - LOG_TRACE("visitor @" << &v << " visiting entity impl @" << this << std::endl); + LOG_TRACE("visitor @" << &v << " visiting entity impl @" << this); v.OnEntry(); for(ChainImplList::iterator it = chain_list_.begin();it!=chain_list_.end();++it) { @@ -848,36 +848,36 @@ EntityView EntityImpl::do_selection(const EntityHandle& eh, { BondTableType bond_table; - LOGN_DUMP("entering do selection"); + LOG_DEBUG("entering do selection"); size_t chain_count = 0, residue_count = 0, atom_count = 0; bool c_added, r_added; - LOGN_DUMP("creating view"); + LOG_DEBUG("creating view"); EntityView view(eh); - LOGN_DUMP("creating query state"); + LOG_DEBUG("creating query state"); EntityHandle myself(const_cast<impl::EntityImpl*>(this)->shared_from_this()); QueryState qs(query.CreateQueryState(myself)); - LOGN_DUMP("entering chain loop"); + LOG_DEBUG("entering chain loop"); for (ChainImplList::const_iterator ch_it=chain_list_.begin(); ch_it!=chain_list_.end();++ch_it) { - LOGN_DUMP("checking chain " << (*ch_it)->GetName()); + LOG_DEBUG("checking chain " << (*ch_it)->GetName()); c_added = false; tribool c = always_true ? tribool(true) : qs.EvalChain(*ch_it); if (c == true) { - LOGN_DUMP("chain is selected"); + LOG_DEBUG("chain is selected"); // Include all residues const ChainImplPtr& ci=*ch_it; ++chain_count; ChainView chain=view.AddChain(ci); ResidueImplList::const_iterator re_it = ci->GetResidueList().begin(); for ( ;re_it!=ci->GetResidueList().end();++re_it) { - LOGN_DUMP(" adding residue " << (*re_it)->GetNumber()); + LOG_DEBUG(" adding residue " << (*re_it)->GetNumber()); ResidueImplPtr& ri = const_cast<ResidueImplPtr&>(*re_it); ++residue_count; ResidueView res =chain.AddResidue(ri); AtomImplList::const_iterator at_it = ri->GetAtomList().begin(); for (;at_it != ri->GetAtomList().end(); ++at_it) { - LOGN_DUMP(" adding atom " << (*at_it)->GetName()); + LOG_DEBUG(" adding atom " << (*at_it)->GetName()); ++atom_count; if (flags & QueryFlag::NO_BONDS) { res.AddAtom(*at_it); @@ -894,11 +894,11 @@ EntityView EntityImpl::do_selection(const EntityHandle& eh, ChainView chain; ResidueImplList::const_iterator re_it = ci->GetResidueList().begin(); for ( ;re_it!=ci->GetResidueList().end();++re_it) { - LOGN_DUMP(" checking residue " << (*re_it)->GetNumber()); + LOG_DEBUG(" checking residue " << (*re_it)->GetNumber()); tribool r = qs.EvalResidue(*re_it); ResidueImplPtr& ri = const_cast<ResidueImplPtr&>(*re_it); if (r == true) { - LOGN_DUMP(" residue is selected"); + LOG_DEBUG(" residue is selected"); // Include all atoms ResidueImplPtr& ri = const_cast<ResidueImplPtr&>(*re_it); AtomImplList::const_iterator at_it = ri->GetAtomList().begin(); @@ -910,7 +910,7 @@ EntityView EntityImpl::do_selection(const EntityHandle& eh, ++residue_count; ResidueView res=chain.AddResidue(ri); for (;at_it != ri->GetAtomList().end(); ++at_it) { - LOGN_DUMP(" adding atom " << (*at_it)->GetName()); + LOG_DEBUG(" adding atom " << (*at_it)->GetName()); ++atom_count; if (flags & QueryFlag::NO_BONDS) { res.AddAtom(*at_it); @@ -941,7 +941,7 @@ EntityView EntityImpl::do_selection(const EntityHandle& eh, if (flags & QueryFlag::MATCH_RESIDUES) { AtomImplList::const_iterator at_it2 = ri->GetAtomList().begin(); for (;at_it2 != ri->GetAtomList().end(); ++at_it2) { - LOGN_DUMP(" adding atom " << (*at_it2)->GetQualifiedName()); + LOG_DEBUG(" adding atom " << (*at_it2)->GetQualifiedName()); ++atom_count; if (flags & QueryFlag::NO_BONDS) { res.AddAtom(*at_it2); @@ -952,7 +952,7 @@ EntityView EntityImpl::do_selection(const EntityHandle& eh, } break; } else { - LOGN_DUMP(" adding atom " << (*at_it)->GetName()); + LOG_DEBUG(" adding atom " << (*at_it)->GetName()); ++atom_count; if (flags & QueryFlag::NO_BONDS) { res.AddAtom(*at_it); @@ -973,7 +973,7 @@ EntityView EntityImpl::do_selection(const EntityHandle& eh, } int bond_count=0; if (!(flags & QueryFlag::NO_BONDS)) { - LOGN_DUMP("adding bonds"); + LOG_DEBUG("adding bonds"); typedef BondTableType::MapType::const_iterator ConstIt; for (ConstIt it=bond_table.bonds.begin();it!=bond_table.bonds.end(); ++it) { if ((QueryFlag::EXCLUSIVE_BONDS & flags) || it->second.IsComplete()) { @@ -983,7 +983,7 @@ EntityView EntityImpl::do_selection(const EntityHandle& eh, } } } - LOGN_VERBOSE("selected " << chain_count << " chain(s), " + LOG_VERBOSE("selected " << chain_count << " chain(s), " << residue_count << " residue(s), " << atom_count << " atom(s)" << " " << bond_count << " bond(s)"); return view; @@ -1063,7 +1063,7 @@ void EntityImpl::UpdateXCSIfNeeded() dirty_flags_&=~DirtyTrace; } if (dirty_flags_ & DirtyXCS) { - LOGN_VERBOSE("XCS marked dirty. Updating"); + LOG_VERBOSE("XCS marked dirty. Updating"); this->UpdateFromICS(); dirty_flags_&=~DirtyXCS; } @@ -1101,12 +1101,12 @@ void EntityImpl::UpdateICSIfNeeded() return; } if (dirty_flags_ & DirtyTrace) { - LOGN_VERBOSE("rerunning directionality trace"); + LOG_VERBOSE("rerunning directionality trace"); this->TraceDirectionality(); this->UpdateFromXCS(); dirty_flags_&=~DirtyTrace; } else if (dirty_flags_ & DirtyICS) { - LOGN_VERBOSE("updating internal from external coordinates"); + LOG_VERBOSE("updating internal from external coordinates"); this->UpdateFromXCS(); dirty_flags_&=~DirtyICS; } @@ -1125,7 +1125,7 @@ void EntityImpl::DecXCSEditorCount() void EntityImpl::UpdateOrganizerIfNeeded() { if (dirty_flags_ & DirtyOrganizer) { - LOGN_DEBUG("atom organizer marked as dirty. updating"); + LOG_DEBUG("atom organizer marked as dirty. updating"); this->UpdateOrganizer(); dirty_flags_&=~DirtyOrganizer; } diff --git a/modules/mol/base/src/impl/residue_impl.cc b/modules/mol/base/src/impl/residue_impl.cc index 225c5a974..b997ced3f 100644 --- a/modules/mol/base/src/impl/residue_impl.cc +++ b/modules/mol/base/src/impl/residue_impl.cc @@ -123,7 +123,7 @@ AtomImplPtr ResidueImpl::InsertAltAtom(const String& name, void ResidueImpl::Apply(EntityVisitor& v) { - LOGN_TRACE("visitor @" << &v << " visiting residue ; @" << this); + LOG_TRACE("visitor @" << &v << " visiting residue ; @" << this); if(v.VisitResidue(ResidueHandle(shared_from_this()))) { for (AtomImplList::iterator it=atom_list_.begin(); it!=atom_list_.end();++it) { @@ -208,7 +208,7 @@ geom::Vec3 ResidueImpl::GetCentralNormal() const geom::Vec3 v0=GetCentralAtom()->GetPos(); nrvo=geom::Cross(geom::Normalize(v0), geom::Normalize(geom::Vec3(-v0[2],v0[0],v0[1]))); - LOGN_VERBOSE("warning: could not find atoms for proper central normal calculation"); + LOG_VERBOSE("warning: could not find atoms for proper central normal calculation"); } return nrvo; } else if (chem_class_.IsNucleotideLinking()) { @@ -222,7 +222,7 @@ geom::Vec3 ResidueImpl::GetCentralNormal() const geom::Vec3 v0=GetCentralAtom()->GetPos(); nrvo=geom::Cross(geom::Normalize(v0), geom::Normalize(geom::Vec3(-v0[2],v0[0],v0[1]))); - LOGN_VERBOSE("warning: could not find atoms for proper central normal calculation"); + LOG_VERBOSE("warning: could not find atoms for proper central normal calculation"); } return nrvo; } @@ -263,7 +263,7 @@ TorsionImplP ResidueImpl::GetPsiTorsion() const { return t; } - LOGN_DUMP("Can't find torsion PSI for " << + LOG_DEBUG("Can't find torsion PSI for " << this->GetKey() << this->GetNumber()); return TorsionImplP(); @@ -303,7 +303,7 @@ TorsionImplP ResidueImpl::GetOmegaTorsion() const { return t; } - LOGN_DUMP("Can't find torsion Omega for " << + LOG_DEBUG("Can't find torsion Omega for " << this->GetKey() << this->GetNumber()); return TorsionImplP(); } @@ -327,7 +327,7 @@ TorsionImplP ResidueImpl::GetPhiTorsion() const { return t; } - LOGN_DUMP("Can't find torsion PHI for " << + LOG_DEBUG("Can't find torsion PHI for " << this->GetKey() << this->GetNumber()); return TorsionImplP(); } diff --git a/modules/mol/base/src/impl/torsion_impl.cc b/modules/mol/base/src/impl/torsion_impl.cc index 6239f4990..42e6b1bb4 100644 --- a/modules/mol/base/src/impl/torsion_impl.cc +++ b/modules/mol/base/src/impl/torsion_impl.cc @@ -51,7 +51,7 @@ void TorsionImpl::SetAngle(Real angle, bool up) { } void TorsionImpl::Apply(EntityVisitor& v) { - LOG_TRACE("visitor @" << &v << " visiting torsion impl @" << this << std::endl); + LOG_TRACE("visitor @" << &v << " visiting torsion impl @" << this); v.VisitTorsion(TorsionHandle(shared_from_this())); } diff --git a/modules/mol/base/src/surface_builder.cc b/modules/mol/base/src/surface_builder.cc index 4fd1a97e4..ecd26cab2 100644 --- a/modules/mol/base/src/surface_builder.cc +++ b/modules/mol/base/src/surface_builder.cc @@ -28,7 +28,7 @@ namespace ost { namespace mol { SurfaceHandle BuildSurface(const EntityView& ev, Real probe_radius, Real patch_size) { - LOGN_ERROR("not yet implemented"); + LOG_ERROR("not yet implemented"); return SurfaceHandle(); } diff --git a/modules/qa/src/packing_statistics.cc b/modules/qa/src/packing_statistics.cc index 03390bc39..8b6baddea 100644 --- a/modules/qa/src/packing_statistics.cc +++ b/modules/qa/src/packing_statistics.cc @@ -36,7 +36,7 @@ PackingStatistics::PackingStatistics(Real cutoff, histogram_(IntegralClassifier(Xxx, 0), // Xxx is the last object in enum and therefore corresponds to the total number of atom types IntegralClassifier((max_counts/bucket_size)+1, 0)) { // since zero counts is possible, we have n+1 bins if (max_counts%bucket_size!=0) { - LOGN_MESSAGE("initialising packing statistics with max_count=" + LOG_INFO("initialising packing statistics with max_count=" << max_counts << "which is not divisible by bucket_size=" << bucket_size << "without remainder. Will continue anyway."); } diff --git a/modules/qa/src/solis_torsion_potential.cc b/modules/qa/src/solis_torsion_potential.cc index a7b0ffde0..1a61d4d25 100644 --- a/modules/qa/src/solis_torsion_potential.cc +++ b/modules/qa/src/solis_torsion_potential.cc @@ -72,7 +72,7 @@ public: num_torsions_++; } else { - LOGN_MESSAGE("Amino acid not found in alphabets..."); + LOG_INFO("Amino acid not found in alphabets..."); } prev_=center_; center_=c; diff --git a/modules/qa/src/torsion_potential.cc b/modules/qa/src/torsion_potential.cc index 828c6365b..651718a4f 100644 --- a/modules/qa/src/torsion_potential.cc +++ b/modules/qa/src/torsion_potential.cc @@ -85,7 +85,7 @@ public: num_torsions_++; } else { - LOGN_MESSAGE("Amino acid not found in alphabets..."); + LOG_INFO("Amino acid not found in alphabets..."); } return false; } diff --git a/scripts/init.py b/scripts/init.py index 2b7a9f24f..a7339db3c 100644 --- a/scripts/init.py +++ b/scripts/init.py @@ -151,7 +151,8 @@ class OstOptionParser(optparse.OptionParser): parser=OstOptionParser(usage=usage,conflict_handler="resolve") parser.add_option("-h", "--help", action="callback", callback=show_help, help="show this help message and exit") -parser.add_option("-v", "--verbosity_level", action="store", type="int", dest="vlevel", default=0, help="sets the verbosity level [default: %default]") +parser.add_option("-v", "--verbosity_level", action="store", type="int", dest="vlevel", default=2, + help="sets the verbosity level [default: %default]") parser.add_option("-s", "--script", action="callback", default=[], dest="script", type="string", callback=parse_script_option, help="executes a script (syntax: -s SCRIPT [options] [args]) Anything that follows this option is passed to the script") parser.add_option("-p", "--pdb_id", dest="pdb_ids", default=[],action="append", help="PDB file ID. The file will be retrieved from PDB") parser.add_option("-b", "--builder", dest="builder", default="HEURISTIC", help="Type of builder used by the progam (either RULE_BASED or HEURISTIC) [default: %default]") @@ -203,4 +204,3 @@ if len(loading_list)!=0 or len(options.pdb_ids)!=0: scene.Autoslab() if len(script_argv)!=0: _execute_script() - diff --git a/scripts/init_cl.py b/scripts/init_cl.py index eb7168357..971b6ea1e 100644 --- a/scripts/init_cl.py +++ b/scripts/init_cl.py @@ -22,7 +22,7 @@ class OstOptionParser(optparse.OptionParser): parser=OstOptionParser(usage=usage,conflict_handler="resolve") parser.add_option("-i", "--interactive", action="callback", callback=interactive_flag, help="start interpreter interactively (must be first parameter, ignored otherwise)") parser.add_option("-h", "--help", action="callback", callback=show_help, help="show this help message and exit") -parser.add_option("-v", "--verbosity_level", action="store", type="int", dest="vlevel", default=0, help="sets the verbosity level [default: %default]") +parser.add_option("-v", "--verbosity_level", action="store", type="int", dest="vlevel", default=2, help="sets the verbosity level [default: %default]") parser.disable_interspersed_args() (options, args) = parser.parse_args() -- GitLab