Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:56

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2020-2023 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file VecGeom/management/LoggerTypes.h
0007 //! \brief Type definitions for logging utilities
0008 //---------------------------------------------------------------------------//
0009 #pragma once
0010 
0011 #include <functional>
0012 #include <string>
0013 
0014 namespace vecgeom {
0015 
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Enumeration for how important a log message is.
0019  */
0020 enum class LogLevel {
0021   debug,      //!< Debugging messages
0022   diagnostic, //!< Diagnostics about current program execution
0023   status,     //!< Program execution status (what stage is beginning)
0024   info,       //!< Important informational messages
0025   warning,    //!< Warnings about unusual events
0026   error,      //!< Something went wrong, but execution can continue
0027   critical,   //!< Something went terribly wrong, should probably abort
0028   size_       //!< Sentinel value for looping over log levels
0029 };
0030 
0031 //---------------------------------------------------------------------------//
0032 // Get the plain text equivalent of the log level above
0033 char const *to_cstring(LogLevel);
0034 
0035 //---------------------------------------------------------------------------//
0036 //! Stand-in for a more complex class for the "provenance" of data
0037 struct Provenance {
0038   std::string file; //!< Originating file
0039   int line = 0;     //!< Line number
0040 };
0041 
0042 //! Type for handling a log message
0043 using LogHandler = std::function<void(Provenance, LogLevel, std::string)>;
0044 
0045 //---------------------------------------------------------------------------//
0046 }  // namespace vecgeom::VECGEOM_IMPL_NAMESPACE