SBM ModScript Reference → Programming SBM ModScript → Constants → LogLevelConstants
Global constant object. Used for Log.GetReportingLevel(), Log.SetReportingLevel(), and Log.Message().
SBM ModScript version: 11.3.
//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(LogLevelConstants.NONE, "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(LogLevelConstants.NONE, "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(LogLevelConstants.MINIMAL,"Message level MINIMAL" ); myLog.Message(LogLevelConstants.VERBOSE(), "Message level VERBOSE" ); //Logs the message with frmt (format string) myLog.Message(LogLevelConstants.AVERAGE, "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();
Copyright © 2007–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.