X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fcore%2Ftracing%2FLogger.hpp;h=ec0c50e37b7154a3fc66ab6873d0c68ec6c8495e;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=b6d4c3864a97ff4594392adea6a6ebeeb29814ee;hpb=3e258840b15577cb8bda3cdedd0b9b88e16404b3;p=anna.git diff --git a/include/anna/core/tracing/Logger.hpp b/include/anna/core/tracing/Logger.hpp index b6d4c38..ec0c50e 100644 --- a/include/anna/core/tracing/Logger.hpp +++ b/include/anna/core/tracing/Logger.hpp @@ -1,37 +1,9 @@ -// ANNA - Anna is Not Nothingness Anymore -// -// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo -// -// https://bitbucket.org/testillano/anna -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Authors: eduardo.ramos.testillano@gmail.com -// cisco.tierra@gmail.com +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // #ifndef anna_core_tracing_Logger_hpp @@ -91,7 +63,7 @@ public: @param id Identificador logico. Usado en el DefaultWriter para inicializar el sistema del log (metodo syslog). */ - virtual void initialize(const char* id) throw() = 0; + virtual void initialize(const char* id) = 0; /** Transfiere el mensaje de trazas al log del sistema. El metodo implementado debe ser @@ -103,7 +75,7 @@ public: @param level Nivel de las trazas que vamos a sacar. @param text Especificacion de formato del mensaje. Similar al usado en el comando sprintf. */ - virtual void do_write(int level, const char* text, ...) throw() = 0; + virtual void do_write(int level, const char* text, ...) = 0; protected: /** @@ -122,7 +94,7 @@ public: @return La instancia del bloque de datos con memoria reservada para poder interpretar los parametros. */ - DataBlock& getDataBlock() throw() { return *a_dataBlock; } + DataBlock& getDataBlock() { return *a_dataBlock; } private: DataBlock* a_dataBlock; @@ -144,7 +116,7 @@ public: @see DefaultWriter. */ - static void initialize(const char* ident) throw(); + static void initialize(const char* ident) ; /** Inicializa el sistema de historico de nuestra aplicacion. Solo debe invocarse una unica vez @@ -163,12 +135,12 @@ public: @see DefaultWriter. */ - static void initialize(const char* ident, Writer* writer) throw(); + static void initialize(const char* ident, Writer* writer) ; /** @return El nivel de trazado de nuestra aplicacion. */ - static Level getLevel() throw() { return st_level; } + static Level getLevel() { return st_level; } /** Establece el nivel de trazado de nuestra aplicacion. El nivel de trazado por defecto @@ -181,7 +153,7 @@ public: @param level Nivel de trazado que deseamos establecer. */ static void setLevel(const Level level) - throw(RuntimeException) { + noexcept(false) { Guard guard(st_mutex, "Logger::setLevel"); st_level = (level <= Error) ? Error : level; } @@ -194,20 +166,20 @@ public: @return @em true Si el nivel de trazado de nuestra aplicacion es mayor que el recibido como parametro o @em false en otro caso. */ - static bool isActive(const Level level) throw() { + static bool isActive(const Level level) { return (st_writer != NULL && level <= Error) ? true : (st_enabled && level <= st_level && st_writer != NULL); } /** Desactiva el sistema de trazado. */ - static void disable() throw(RuntimeException); + static void disable() noexcept(false); /** Activa el sistema de trazado y establece el nivel de trazado existente antes de la desactivacion (Ver #disable). */ - static void enable() throw(RuntimeException); + static void enable() noexcept(false); /** * Establece el valor del indicador que hace que se vuelque el PID del proceso en la linea de trazas. @@ -216,7 +188,7 @@ public: * * \param showPID Valor del indicador. */ - static void showPID(const bool show) throw(); + static void showPID(const bool show) ; /** Traza el texto recibido en el historico con el nivel indicado. @@ -229,7 +201,7 @@ public: @param fromFile Nombre del archivo donde se genera la traza. @param fromLine Numero de linea del archivo donde se genera la traza. */ - static void write(const Level level, const char* text, const char* fromFile, const int fromLine) throw(); + static void write(const Level level, const char* text, const char* fromFile, const int fromLine) ; /** Traza el texto recibido en el historico con el nivel indicado. @@ -242,7 +214,7 @@ public: @param fromFile Nombre del archivo donde se genera la traza. @param fromLine Numero de linea del archivo donde se genera la traza. */ - static void write(const Level level, const std::string& text, const char* fromFile, const int fromLine) throw() { + static void write(const Level level, const std::string& text, const char* fromFile, const int fromLine) { write(level, text.c_str(), fromFile, fromLine); } @@ -258,7 +230,7 @@ public: @param fromFile Nombre del archivo donde se genera la traza. @param fromLine Numero de linea del archivo donde se genera la traza. */ - static void write(const Level level, const char* text, const char* value, const char* fromFile, const int fromLine) throw(); + static void write(const Level level, const char* text, const char* value, const char* fromFile, const int fromLine) ; /** Traza el texto recibido en el historico con el nivel indicado. @@ -273,7 +245,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void write(const Level level, const char* text, const std::string& value, const char* fromFile, const int fromLine) - throw() { + { write(level, text, value.c_str(), fromFile, fromLine); } @@ -290,7 +262,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void write(const Level level, const std::string& text, const std::string& value, const char* fromFile, const int fromLine) - throw() { + { write(level, text.c_str(), value.c_str(), fromFile, fromLine); } @@ -307,7 +279,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void write(const Level level, const char* text, const int value, const char* fromFile, const int fromLine) - throw(); + ; /** Traza el texto recibido en el historico con el nivel indicado. @@ -322,7 +294,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void write(const Level level, const char* text, const DataBlock& value, const char* fromFile, const int fromLine) - throw(); + ; /** Si el nivel \em Debug esta activado traza el texto recibido en el historico. @@ -331,7 +303,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void debug(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Debug, text, fromFile, fromLine); } @@ -342,7 +314,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void information(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Information, text, fromFile, fromLine); } @@ -353,7 +325,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void notice(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Notice, text, fromFile, fromLine); } @@ -364,7 +336,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void warning(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Warning, text, fromFile, fromLine); } @@ -375,7 +347,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void error(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Error, text, fromFile, fromLine); } @@ -386,7 +358,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void critical(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Critical, text, fromFile, fromLine); } @@ -397,7 +369,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void alert(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Alert, text, fromFile, fromLine); } @@ -408,7 +380,7 @@ public: @param fromLine Numero de linea del archivo donde se genera la traza. */ static void emergency(const std::string& text, const char* fromFile, const int fromLine) - throw() { + { write(Logger::Emergency, text, fromFile, fromLine); } @@ -416,7 +388,7 @@ public: @return La cadena que identifica al nivel recibido como parametro. */ - static const char* asString(const Level level) throw(); + static const char* asString(const Level level) ; /** Traduce la cadena recibida al nivel correspondiente. @@ -425,7 +397,7 @@ public: \warning Debe de ser alguno de los siguiente literales: emerg, alert, crit, err, warning, notice, info, debug */ - static Level asLevel(const char* level) throw(RuntimeException); + static Level asLevel(const char* level) noexcept(false); private: static NRMutex st_mutex;