Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
SessionLog Class Reference

Mirror stdout and stderr into one session file for a scoped run. More...

#include <application_runtime.h>

Collaboration diagram for SessionLog:

Public Member Functions

 SessionLog (const fs::path &directory, const fs::path &filename="pangea.log")
 Open an append-only session log and install console mirroring.
 ~SessionLog ()
 Detach the tee buffers before their file and lock are destroyed.

Private Attributes

std::ofstream file_
std::mutex mutex_
TeeBuffer output_
TeeBuffer errors_
std::streambuf * oldOutput_
std::streambuf * oldErrors_

Detailed Description

Mirror stdout and stderr into one session file for a scoped run.

Construction installs the tee buffers and destruction restores the streams that were active before the session. Keep this object alive for the whole operation so worker diagnostics cannot outlive the file stream.

Definition at line 96 of file application_runtime.h.

Constructor & Destructor Documentation

◆ SessionLog()

SessionLog::SessionLog ( const fs::path & directory,
const fs::path & filename = "pangea.log" )
inlineexplicit

Open an append-only session log and install console mirroring.

Parameters
[in]directoryExisting working directory for the session.
[in]filenameLog name relative to directory.
Exceptions
std::runtime_errorIf the log cannot be opened.

Definition at line 110 of file application_runtime.h.

◆ ~SessionLog()

SessionLog::~SessionLog ( )
inline

Detach the tee buffers before their file and lock are destroyed.

Workers must already be stopped before restoring global streams.

Definition at line 121 of file application_runtime.h.

Field Documentation

◆ errors_

TeeBuffer SessionLog::errors_
private

Definition at line 100 of file application_runtime.h.

◆ file_

std::ofstream SessionLog::file_
private

Definition at line 97 of file application_runtime.h.

◆ mutex_

std::mutex SessionLog::mutex_
private

Definition at line 98 of file application_runtime.h.

◆ oldErrors_

std::streambuf* SessionLog::oldErrors_
private

Definition at line 102 of file application_runtime.h.

◆ oldOutput_

std::streambuf* SessionLog::oldOutput_
private

Definition at line 101 of file application_runtime.h.

◆ output_

TeeBuffer SessionLog::output_
private

Definition at line 99 of file application_runtime.h.


The documentation for this class was generated from the following file: