Log

Description

(On-premise only)

A class for writing output messages and appending an output log file. Optionally, datestamps can be pre-pended to output messages.

Methods

Example:

//Basic example of working with the Log class
var filePath = "Script.log";
//Creates a Log Object
var myLog = Log();
//Opens the Log Object
var isOpened = myLog.Open( filePath );
myLog.Message(1, "Is log opened " + isOpened);
//Starts a new Log file when MaxSize is reached
var backUpFileSet = myLog.SetBackUpLogFile("True");
//Sets the number of bytes the log file should grow to before it is truncated
var maxSize = myLog.SetMaxSize(10485760);
//Adds timestamps to the entries
var wantTimeStamp = myLog.SetWantTimeStamp("True");
//Returns the current logging level
myLog.Message(1, "Log reporting level: " + myLog.GetReportingLevel());
//Sets the log reporting level to Minimal
reportLevel = myLog.SetReportingLevel(LogLevelConstants.MINIMAL);
myLog.Message(myLog.NONE(), "Message level NONE" );
myLog.Message(2,"Message level MINIMAL" );
myLog.Message(LogLevelConstants.VERBOSE(), "Message level VERBOSE" );
//Logs the message with frmt (format string)
myLog.Message(3, "Testing the {0} {1} to check that '{0}' {1}s to {0}. {2}, {3}, {4}",
 "STRING", "FORMAT", 2, 3, 4);
//Closes the Log Object
myLog.Close();

Related Topics

Object Types

Application Objects