![]() |
|
|||
File indexing completed on 2025-09-17 08:54:06
0001 //------------------------------- -*- C++ -*- -------------------------------// 0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details 0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT) 0004 //---------------------------------------------------------------------------// 0005 //! \file corecel/io/LogHandlers.hh 0006 //---------------------------------------------------------------------------// 0007 #pragma once 0008 0009 #include <iosfwd> 0010 #include <string> 0011 0012 #include "LoggerTypes.hh" 0013 0014 namespace celeritas 0015 { 0016 //---------------------------------------------------------------------------// 0017 /*! 0018 * Simple log handler: write with colors to a long-lived ostream reference. 0019 */ 0020 class StreamLogHandler 0021 { 0022 public: 0023 //! Construct with long-lived reference to a stream 0024 explicit StreamLogHandler(std::ostream& os) : os_{os} {} 0025 0026 // Write the message to the stream 0027 void operator()(LogProvenance, LogLevel, std::string) const; 0028 0029 private: 0030 std::ostream& os_; 0031 }; 0032 0033 //---------------------------------------------------------------------------// 0034 /*! 0035 * Log with a shared mutex guarding the stream output. 0036 */ 0037 class MutexedStreamLogHandler 0038 { 0039 public: 0040 //! Construct with long-lived reference to a stream 0041 explicit MutexedStreamLogHandler(std::ostream& os) : os_{os} {} 0042 0043 // Write the message to the stream 0044 void operator()(LogProvenance, LogLevel, std::string) const; 0045 0046 private: 0047 std::ostream& os_; 0048 }; 0049 0050 //---------------------------------------------------------------------------// 0051 } // namespace celeritas
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |