forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LocalLogger.hh
41 lines (35 loc) · 1.15 KB
/
LocalLogger.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//----------------------------------*-C++-*----------------------------------//
// Copyright 2023 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celer-g4/LocalLogger.hh
//---------------------------------------------------------------------------//
#pragma once
#include <string>
#include "corecel/Assert.hh"
#include "corecel/io/LoggerTypes.hh"
namespace celeritas
{
namespace app
{
//---------------------------------------------------------------------------//
/*!
* Celeritas-style multithreaded logger that writes to std::clog.
*/
class LocalLogger
{
public:
// Construct with defaults
explicit LocalLogger(int num_threads) : num_threads_(num_threads)
{
CELER_EXPECT(num_threads_ > 0);
}
// Write a log message
void operator()(Provenance prov, LogLevel lev, std::string msg);
private:
int num_threads_;
};
//---------------------------------------------------------------------------//
} // namespace app
} // namespace celeritas