Skip to content
Kirk edited this page Sep 18, 2016 · 5 revisions

The SonyAPILib has it's own basic logging system.
This can be implemented in to your own program by setting the Log object properties.

This class contains the methods and Properties used in the API Logging system.


Syntax

public class APILibrary.Log()


Methods

AddMessage

Write a message line to the API Log file.
Syntax: mySonyLib.Log.AddMessage(message, oride);
Param message is a string containing the TEXT to write to the file.
Param oride is a Bool value that sets if the line should be logged regardless of the logging Level value.
For example: mySonyLib.Log.AddMessage("This is my Text", true); will write this line to the log file NO matter what the logging level is set to.

=== ####ClearLog
Clears the contents of the Log File.
Syntax: mySonyLib.Log.ClearLog(newName);
Param newName if not set to "null", will rename the existing logfile to newName before clearing. NOTE: Must be a text file (.txt)

This example will just clear the log: mySonyLib.Log.ClearLog(null);
This example will copy the log file to a new file with the name provided, then clear the log file: mySonyLib.Log.ClearLog("Old_LOG_File.txt");


Properties

Enable

Set to True or False to turn Logging On or Off.
Syntax: mySonyLib.Log.Enable = true. (Default is set to FALSE).

===

Level

Set the level of logging. "Basic" only logs minimal information where "All" logs all information.
Syntax:
mySonyLib.Log.Level = "All". (Default is set to "Basic").

===

Path

Sets the location to save the Logging file.
Syntax:
mySonyLib.Log.Path = "c:\tempfolder" (Default is set to "C:\ProgramData\Sony").

===

Name

Sets the Log File Name to Use.
Syntax:
mySonyLib.Log.Name = "MySonyLoggingFile.txt" (Default is set to "SonyAPILib_LOG.txt").