Class LogSys

3DS Max Plug-In SDK

Class LogSys

See Also: Class Interface.

class LogSys

Description:

MAX maintains a log file that contains the text of error / warning / information / debug messages generated by the system and plug-ins. This class is used to work with the log and send messages to it. The log file is placed in the Network directory and is called Max.Log. To access this facility from anywhere in MAX use the pointer returned fro the method Interface::Log(). All methods of this class are implemented by the system.

Methods:

Prototype:

virtual DWORD LogTypes();

Remarks:

This method is used to find out what log types are enabled . See List of System Error Log Message Types. The type values are ORed together to create the value returned.

Prototype:

virtual void SetLogTypes(DWORD types);

Remarks:

This method is used to set the log types that are enabled.

Parameters:

DWORD types

See List of System Error Log Message Types.

Prototype:

virtual void LogEntry(DWORD type, BOOL dialogue, TCHAR *title, TCHAR *text,... )=0;

Remarks:

This method is used to log the error.

Parameters:

DWORD type

Defines the type of log entry. See List of System Error Log Message Types.

BOOL dialogue

One of the following values:

NO_DIALOG

If this entry is just some information you don't want a dialogue for, or if you are handling the dialogue yourself use this value.

DISPLAY_DIALOG

Use this value if you want the message to be displayed in a dialogue. The system will determine if displaying a dialogue is appropriate based on network rendering mode.

TCHAR *title

This title string is optional. If non NULL, it will be used to define the module.

TCHAR *text,...

This parameter (and any other additional arguments that follow) make up the format specification. The format matches the standard C printf() function.

Sample Code:

TheManager->Max()->Log()->LogEntry(SYSLOG_ERROR, NO_DIALOG, NULL, _T("%s - %s\n"), ShortDesc(), errText);

Prototype:

virtual int Longevity();

Remarks:

Returns the conditions under which the log is deleted.

Return Value:

One of the following values:

SYSLOG_LIFE_EVER

The log is never deleted.

SYSLOG_LIFE_DAYS

This log is maintained for this number of days.

SYSLOG_LIFE_SIZE

The log is maintained until it reaches this many kilobytes (KB).

Prototype:

virtual void SetLongevity(int type);

Remarks:

Sets the conditions under which the log is deleted.

Parameters:

int type

One of the following values:

SYSLOG_LIFE_EVER

The log is never deleted.

SYSLOG_LIFE_DAYS

This log is maintained for this number of days.

SYSLOG_LIFE_SIZE

The log is maintained until it reaches this many kilobytes (KB).

Prototype:

virtual DWORD LogDays();

Remarks:

Returns the conditions under which the log is cleared.

Return Value:

One of the following values:

SYSLOG_LIFE_EVER

The log is never deleted.

SYSLOG_LIFE_DAYS

This log is maintained for this number of days.

SYSLOG_LIFE_SIZE

The log is maintained until it reaches this many kilobytes (KB).

Prototype:

virtual DWORD LogSize();

Remarks:

Returns the size of the current log file in kilobytes (KB).

Prototype:

virtual void SetLogDays(DWORD days);

Remarks:

Set the number of days the log is maintained.

Parameters:

DWORD days

The number of days to maintain the log. After this many days after creation the log is deleted.

Prototype:

virtual void SetLogSize(DWORD size);

Remarks:

Set the maximum size in kilobytes (KB) of the log file. After this size is reached the log file is deleted.

Parameters:

DWORD size

The maximum size in kilobytes (KB) of the log file.

Prototype:

void SetQuietMode(bool quiet);

Remarks:

This method is available in release 3.0 and later only.

Enables or disables 'quiet' mode. When set to quiet mode, the LogSys::LogEntry(...) method will not bring up any dialog boxes -- it will act as it does in network rendering mode. Note: After setting quiet mode, do not forget to clear it when you are done, since the user will not see any error messages from the renderer while quiet mode is enabled.

Parameters:

bool quiet

TRUE to enable; FALSE to disable.

Prototype:

bool GetQuietMode();

Remarks:

This method is available in release 3.0 and later only.

Returns TRUE if 'quiet' mode is enabled or FALSE if it's disabled. See SetQuietMode() above.

Prototype:

virtual void SaveState()=0;

Remarks:

This method is used internally.

Prototype:

virtual void LoadState()=0;

Remarks:

This method is used internally.