10#include "Application.h"
15 SessionLog::SessionLog() {
17 Isis::PvlGroup &slog = Isis::Preference::Preferences().
findGroup(
"SessionLog");
18 p_termOutput = ((QString)slog[
"TerminalOutput"]).toUpper() ==
"ON";
19 p_fileOutput = ((QString)slog[
"FileOutput"]).toUpper() ==
"ON";
20 p_outputFile = (QString) slog[
"FileName"];
21 p_access = ((QString) slog[
"FileAccess"]).toUpper();
33 SessionLog::~SessionLog() {
40 if(restart && (p_log != NULL)) {
47 p_log =
new SessionLog();
53 void SessionLog::Write() {
60 if(p_access ==
"OVERWRITE") {
64 this->
append(p_outputFile);
68 std::cerr <<
"**WARNING** Unable to write session log [" <<
69 p_outputFile <<
"] Disk may be full or directory permissions not writeable"
77 void SessionLog::AddAccounting() {
79 if(p_acctAdded)
return;
81 p_root->addGroup(Isis::iApp->Accounting());
87 void SessionLog::AddError(Isis::Pvl &e) {
88 for(
int i = 0; i < e.
groups(); i++) {
90 p_root->addGroup(e.
group(i));
97 void SessionLog::AddResults(Isis::PvlGroup &results) {
98 p_root->addGroup(results);
101 std::ostream &
operator<<(std::ostream &os, Isis::SessionLog &log) {
106 void SessionLog::Shutdown() {
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
void write(const QString &file)
Opens and writes PVL information to a file and handles the end of line sequence.
void setTerminator(const QString &term)
Sets the terminator used to signify the end of the PVL informationDefaults to "END".
void append(const QString &file)
Appends PVL information to a file and handles the end of line sequence.
PvlGroup & group(const int index)
Return the group at the specified index.
int groups() const
Returns the number of groups contained.
PvlObject & object(const int index)
Return the object at the specified index.
void addObject(const PvlObject &object)
Add a PvlObject.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
This is free and unencumbered software released into the public domain.
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Namespace for the standard library.