LCOV - code coverage report
Current view: top level - snaplogger - nested_diagnostic.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 15 0.0 %
Date: 2019-08-13 00:35:33 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * License:
       3             :  *    Copyright (c) 2013-2019  Made to Order Software Corp.  All Rights Reserved
       4             :  *
       5             :  *    https://snapwebsites.org/
       6             :  *    contact@m2osw.com
       7             :  *
       8             :  *    This program is free software; you can redistribute it and/or modify
       9             :  *    it under the terms of the GNU General Public License as published by
      10             :  *    the Free Software Foundation; either version 2 of the License, or
      11             :  *    (at your option) any later version.
      12             :  *
      13             :  *    This program is distributed in the hope that it will be useful,
      14             :  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :  *    GNU General Public License for more details.
      17             :  *
      18             :  *    You should have received a copy of the GNU General Public License along
      19             :  *    with this program; if not, write to the Free Software Foundation, Inc.,
      20             :  *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      21             :  *
      22             :  * Authors:
      23             :  *    Alexis Wilke   alexis@m2osw.com
      24             :  */
      25             : 
      26             : /** \file
      27             :  * \brief Appenders are used to append data to somewhere.
      28             :  *
      29             :  * This file declares the base appender class.
      30             :  */
      31             : 
      32             : 
      33             : // self
      34             : //
      35             : #include    "snaplogger/nested_diagnostic.h"
      36             : 
      37             : #include    "snaplogger/guard.h"
      38             : #include    "snaplogger/message.h"
      39             : #include    "snaplogger/private_logger.h"
      40             : 
      41             : 
      42             : // last include
      43             : //
      44             : #include    <snapdev/poison.h>
      45             : 
      46             : 
      47             : 
      48             : namespace snaplogger
      49             : {
      50             : 
      51             : 
      52             : 
      53           0 : nested_diagnostic::nested_diagnostic(std::string const & diagnostic, bool emit_enter_exit_events)
      54           0 :     : f_emit_enter_exit_events(emit_enter_exit_events)
      55             : {
      56           0 :     get_private_logger()->push_nested_diagnostic(diagnostic);
      57             : 
      58           0 :     if(f_emit_enter_exit_events)
      59             :     {
      60           0 :         SNAP_LOG_UNIMPORTANT << "entering nested diagnostic";
      61             :     }
      62           0 : }
      63             : 
      64             : 
      65           0 : nested_diagnostic::~nested_diagnostic()
      66             : {
      67           0 :     if(f_emit_enter_exit_events)
      68             :     {
      69           0 :         SNAP_LOG_UNIMPORTANT << "exiting nested diagnostic";
      70             :     }
      71             : 
      72           0 :     get_private_logger()->pop_nested_diagnostic();
      73           0 : }
      74             : 
      75             : 
      76           0 : string_vector_t get_nested_diagnostics()
      77             : {
      78           0 :     return get_private_logger()->get_nested_diagnostics();
      79             : }
      80             : 
      81             : 
      82           0 : string_vector_t get_nested_diagnostics(message const & msg)
      83             : {
      84           0 :     return get_private_logger(msg)->get_nested_diagnostics();
      85             : }
      86             : 
      87             : 
      88             : 
      89             : } // snaplogger namespace
      90             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.12