Stellarium  HEAD
Static Public Member Functions
StelScriptOutput Class Reference

Class with only static members used to manage output for Stellarium scripts. More...

#include <StelScriptOutput.hpp>

Static Public Member Functions

static void init (const QString &outputFilePath)
 Create and initialize the log file. More...
 
static void deinit ()
 Deinitialize the output file. More...
 
static void writeLog (QString msg)
 Write the message plus a newline to the output file at $USERDIR/output.txt. More...
 
static void reset (void)
 Reset file, i.e., empty it. More...
 
static void saveOutputAs (const QString &name)
 Save to new file, re-create output file. More...
 

Detailed Description

Class with only static members used to manage output for Stellarium scripts.

Member Function Documentation

◆ deinit()

static void StelScriptOutput::deinit ( )
static

Deinitialize the output file.

Must be called after init() was called.

◆ init()

static void StelScriptOutput::init ( const QString &  outputFilePath)
static

Create and initialize the log file.

Prepend system information before any output.

◆ reset()

static void StelScriptOutput::reset ( void  )
static

Reset file, i.e., empty it.

This may be useful to have repetitive output which may be read by other programs. Normally you would call saveOutputAs(...), then reset().

◆ saveOutputAs()

static void StelScriptOutput::saveOutputAs ( const QString &  name)
static

Save to new file, re-create output file.

This allows reading of results on Windows, where otherwise reading programs cannot access files opened for writing by Stellarium.

Parameters
namenew filename. If this is not an absolute path, it will be created in the same directory as output.txt
Note
For storing to absolute path names or paths containing directory navigation (".."), set [scripts]/flag_script_allow_write_absolute_path=true. Normally you would call saveOutputAs(...), then reset().

◆ writeLog()

static void StelScriptOutput::writeLog ( QString  msg)
static

Write the message plus a newline to the output file at $USERDIR/output.txt.

Parameters
msgmessage to write.