|
glogging
|
Batch-mode G4UIsession that tees Geant4 output to files and the terminal.
More...
#include <gbatch_session.h>
Public Member Functions | |
| GBatch_Session () | |
| Constructs the batch session and opens the log streams. | |
| G4int | ReceiveG4cout (const G4String &coutString) override |
Receives Geant4 standard output and tees it to gemc.log and std::cout. | |
| G4int | ReceiveG4cerr (const G4String &cerrString) override |
Receives Geant4 standard error and tees it to gemc.err and std::cerr. | |
This class is designed to be passed to the Geant4 UI manager so that all G4cout and G4cerr traffic is redirected through G4UIsession callbacks. In batch/production runs, this enables persistent log capture while still keeping output visible on the console.
Operational behavior
gemc.log : destination for G4cout outputgemc.err : destination for G4cerr outputgemc.log std::cout gemc.err std::cerr std::ofstream members are destroyed. Definition at line 31 of file gbatch_session.h.
|
inline |
This constructor opens gemc.log and gemc.err for writing.
std::ofstream::open for a filename is to create/truncate the file unless additional open modes are specified.Definition at line 46 of file gbatch_session.h.
|
inlineoverride |
| cerrString | The message fragment provided by Geant4 for standard error. |
std::cerr to reduce the chance of losing diagnostic output if the process terminates unexpectedly. Definition at line 78 of file gbatch_session.h.
|
inlineoverride |
| coutString | The message fragment provided by Geant4 for standard output. |
std::cout to keep logs consistent in long-running batch jobs. Definition at line 61 of file gbatch_session.h.