InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
LogObject Class Reference

#include <LogObject.h>

Public Member Functions

 LogObject (const char *logFileName, bool16 newFile=kTrue, bool16 writeMemoryInfo=kTrue, bool16 autoflush=kFalse)
 
 LogObject (bool16 newFile, const char *logFileName, bool16 autoflush=kFalse)
 
 LogObject (IDFile pathAndName, bool16 newFile=kTrue, bool16 autoflush=kFalse)
 
virtual ~LogObject ()
 
void WriteLog (bool16 terminateLine, const char *format,...)
 
void WriteLogFormat (const char *format, va_list argptr, bool16 terminateLine=kTrue)
 
void WriteLog (const PMString &logString, bool16 terminateLine=kTrue)
 
void WriteDateTime (bool16 terminateLine)
 
void WriteElapsedTime (bool16 terminateLine)
 
void WriteMemoryInfo ()
 
void WriteAvailableMemory ()
 
void WriteMemoryUsed ()
 
void WriteSeparator ()
 
void Indent ()
 
void UnIndent ()
 
int16 GetNumIndents ()
 
void Prepend (const PMString &prepend)
 
void RemovePrepend ()
 
void SetWriteTrailer (bool16 writeTrailer)
 
PMString GetLogFileName (void)
 
void WriteInsert (const PMString &logString, CharCounter startPos)
 
void WriteBasicHeader (const char *fileName)
 

Static Public Member Functions

static PMString GetQAFileDir ()
 
static PMString GetLogFileDir ()
 
static PMString GetBenchmarkDataDir ()
 
static PMString GetPortDirName ()
 

Detailed Description

LogObject allows a caller to create and write to a log, i.e., a text-only file, or append to an existing log.

The constructors use an "autoflush" setting. Before setting that to kTrue, consider the potential impact on performance. The default was changed to kFalse, in order to prevent the time-consuming writing to disk that formerly occurred on startup.

Some methods terminate lines. The terminator varies per platform.

Some methods indent lines. Indenting is accomplished by inserting a fixed number of spaces, sometimes referred to as a "tab."

Constructor & Destructor Documentation

LogObject::LogObject (const char * logFileName,
bool16 newFile = kTrue,
bool16 writeMemoryInfo = kTrue,
bool16 autoflush = kFalse 
)

This constructor wraps an existing log file or creates a new one in a standard location.

Parameters
logFileNameThe name of the file. The remainder of the path is as returned from GetLogFileDir().
newFileIf kTrue, then the file is created.
writeMemoryInfoIf kTrue, then memory info is automatically written once into the log.
autoflushIf kTrue, then the underlying stream is automatically flushed every time a WriteFoo() method is called.
LogObject::LogObject (bool16 newFile,
const char * logFileName,
bool16 autoflush = kFalse 
)

This constructor wraps an existing log file or creates a new one in a standard location, and it suppresses the standard header and trailer.

Parameters
newFileIf kTrue, then the file is created.
logFileNameThe name of the file. The remainder of the path is as returned from GetLogFileDir().
autoflushIf kTrue, then the underlying stream is automatically flushed every time a WriteFoo() method is called.
LogObject::LogObject (IDFile pathAndName,
bool16 newFile = kTrue,
bool16 autoflush = kFalse 
)

This constructor wraps an existing log file or creates a new one in the specified location, and it suppresses the standard header and trailer.

Parameters
pathAndNameThe name of the file. The remainder of the path is as returned from GetLogFileDir().
newFileIf kTrue, then the file is created.
writeMemoryInfoIf kTrue, then memory info is automatically written into the log.
autoflushIf kTrue, then the underlying stream is automatically flushed every time a WriteFoo() method is called.
virtual LogObject::~LogObject ()
virtual

The destructor writes the standard trailer according to the setting set by the constructor; flushes the underlying stream, if autoflush has not been specified; then, closes the stream.

Member Function Documentation

static PMString LogObject::GetBenchmarkDataDir ()
static

Returns the location of the standard folder for storing output from benchmarking tests. For InDesign Server, this includes a subfolder named after the configuration.

Returns
The location of the Benchmark:Data folder.
static PMString LogObject::GetLogFileDir ()
static

Returns the location of the standard folder for storing logs. For InDesign Server, this includes a subfolder named after the configuration.

Returns
The location of the Logs folder.
PMString LogObject::GetLogFileName (void )

Returns the filename of the log.

Returns
The filename.
int16 LogObject::GetNumIndents ()

Returns the measure of the current indent.

Returns
The number of tabs in the indent.
static PMString LogObject::GetPortDirName ()
static

Returns the configuration name used by InDesign Server.

Returns
The configuration name.
static PMString LogObject::GetQAFileDir ()
static

Returns the location of the QA folder, which is used to store various testing resources, including standard logs.

Returns
The location of the QA folder.
void LogObject::Indent ()

Increases the indent by one tab.

void LogObject::Prepend (const PMStringprepend)

Specifies a string to be appended automatically before the material specified in WriteLog().

Parameters
prependThe string to append.
void LogObject::RemovePrepend ()

Clears the string specified by Prepend().

void LogObject::SetWriteTrailer (bool16 writeTrailer)
inline

Turns on or off the flag that determines whether a trailer shall be written by the destructor.

Parameters
writeTrailerIf kTrue, a trailer is written.
void LogObject::UnIndent ()

Reduces the indent by one tab.

void LogObject::WriteAvailableMemory ()

Appends data about available memory.

void LogObject::WriteBasicHeader (const char * fileName)

Writes the standard header information.

Parameters
fileNameThe name to be used in the header to specify this log.
void LogObject::WriteDateTime (bool16 terminateLine)

Appends the current date and time.

Parameters
terminateLineIf kTrue, a line terminator is further appended.
void LogObject::WriteElapsedTime (bool16 terminateLine)

Appends the length of time since this object was constructed.

Parameters
terminateLineIf kTrue, a line terminator is further appended.
void LogObject::WriteInsert (const PMStringlogString,
CharCounter startPos 
)

Inserts a string into the log at the specified position.

Parameters
logStringThe string.
startPosThe position.
void LogObject::WriteLog (bool16 terminateLine,
const char * format,
 ... 
)

Appends the specified text.

Parameters
terminateLineIf kTrue, a line terminator is further appended.
formatA "printf"-type string.
...Any variables called for by "format".
void LogObject::WriteLog (const PMStringlogString,
bool16 terminateLine = kTrue 
)

Appends the specified string.

Parameters
logStringThe string.
terminateLineIf kTrue, a line terminator is further appended.
void LogObject::WriteLogFormat (const char * format,
va_list argptr,
bool16 terminateLine = kTrue 
)

Appends the specified text.

Parameters
formatA "printf"-type string.
argptrArgument list, contains any variables called for by "format".
terminateLineIf kTrue, a line terminator is further appended.
void LogObject::WriteMemoryInfo ()

Appends data about available memory and memory used since this object was constructed.

void LogObject::WriteMemoryUsed ()

Appends data about memory used since this object was constructed.

void LogObject::WriteSeparator ()

Appends a line of dashes.