LogSys Class Reference

#include <log.h>

Class Description

Class for writing out log information to a file.

Remarks
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 from the method Interface::Log(). All methods of this class are implemented by the system.
See also
Class Interface.
+ Inheritance diagram for LogSys:

Public Member Functions

virtual ~LogSys ()
 
virtual DWORD LogTypes ()
 
virtual void SetLogTypes (DWORD types)
 
virtual void LogEntry (DWORD type, BOOL dialogue, const MCHAR *title, const MCHAR *format,...)=0
 
virtual void SetQuietMode (bool quiet)=0
 Enables or disables 'quiet' mode. More...
 
virtual bool GetQuietMode ()=0
 Gets the Quiet Mode. More...
 
virtual void SetEnabledMode (bool enabled)=0
 Enables or disables 'enabled' mode. More...
 
virtual bool GetEnabledMode ()=0
 Gets the 'enabled' mode. More...
 
virtual void SetSessionLogName (const MCHAR *logName)=0
 Sets additional output log file on session basis. More...
 
virtual const MCHARGetSessionLogName ()=0
 Retrieves the additional output log file name. More...
 
virtual const MCHARNetLogName ()=0
 Retrieves the output log file name. More...
 
Log File Longevity
virtual int Longevity ()
 Returns the conditions under which the log is deleted. More...
 
virtual void SetLongevity (int type)
 Sets the conditions under which the log is deleted. More...
 
virtual DWORD LogDays ()
 Returns the conditions under which the log is cleared. More...
 
virtual DWORD LogSize ()
 Returns the size of the current log file in kilobytes (KB). More...
 
virtual void SetLogDays (DWORD days)
 Set the number of days the log is maintained. More...
 
virtual void SetLogSize (DWORD size)
 Set the maximum size in kilobytes (KB) of the log file. More...
 
State
virtual void SaveState (void)=0
 
virtual void LoadState (void)=0
 

Protected Attributes

DWORD valTypes
 
int logLife
 
DWORD logDays
 
DWORD logSize
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Constructor & Destructor Documentation

virtual ~LogSys ( )
inlinevirtual
101 { valTypes = types; }
DWORD valTypes
Definition: log.h:95

Member Function Documentation

virtual DWORD LogTypes ( )
inlinevirtual
Remarks
This method is used to find out what log types are enabled. See System Error Log Message Types. The type values are ORed together to create the value returned.
174 { return logLife; }
int logLife
Definition: log.h:96
virtual void SetLogTypes ( DWORD  types)
inlinevirtual
Remarks
This method is used to set the log types that are enabled.
Parameters
types- Sets the type of log messages See System Error Log Message Types.
174 { return logLife; }
int logLife
Definition: log.h:96
virtual void LogEntry ( DWORD  type,
BOOL  dialogue,
const MCHAR title,
const MCHAR format,
  ... 
)
pure virtual
Remarks
This method is used to log the error.
Parameters
type- Defines the type of log entry defined in this header file. See System Error Log Message Types. Note that since the System Error Log Message Types are specified as bit flag values, multiple types can be specified (although normally only a single type is specified). If multiple types are specified, the highest severity type that matches with the enabled log types is used. The types in level of severity are error, warn, info, debug.
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.
title- This title string is optional. If non NULL, it will be used to define the module.
format- This parameter (and any other additional arguments that follow) make up the format specification. The format matches the standard C printf() function.
TheManager-\>Max()-\>Log()-\>LogEntry(SYSLOG_ERROR, NO_DIALOG, _M("Warning Title") ,_M("%s - %s\n"), ShortDesc(), errText);
virtual void SetQuietMode ( bool  quiet)
pure virtual

Enables or disables 'quiet' mode.

Remarks
When set to quiet mode, the LogSys::LogEntry(...) method will not bring up any dialog boxes. Thus it will act as it does in network rendering mode. That is the error will only be written to the log file.
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
quiet- true to enable, false to disable.
virtual bool GetQuietMode ( )
pure virtual

Gets the Quiet Mode.

Returns
true if 'quiet' mode is enabled or false if it's disabled.
virtual void SetEnabledMode ( bool  enabled)
pure virtual

Enables or disables 'enabled' mode.

Remarks
When set to not enabled, the LogSys::LogEntry(...) method will not log the message nor bring up any dialog boxes.
Note
After setting to not enabled, do not forget to re-enable it when you are done, since no logging of information will be performed.
Parameters
enabled- true to enable, false to disable.
virtual bool GetEnabledMode ( )
pure virtual

Gets the 'enabled' mode.

Returns
true if 'enabled' mode is enabled or false if it's disabled.
virtual void SetSessionLogName ( const MCHAR logName)
pure virtual

Sets additional output log file on session basis.

This method defines additional log file in specified location. Unlike default max.log file, the output is based on session. If the given file exists, its contents are destroyed.

Parameters
[in]logName- output file name. If an empty (but non-null) string is specified, the additional output log file is disabled. If the logName is not a valid file name, the current additional output log file (if any) will continue to be used.
virtual const MCHAR* GetSessionLogName ( )
pure virtual

Retrieves the additional output log file name.

Returns
- the output file name set in SetSessionLogName() call or NULL if no file specified.
virtual const MCHAR* NetLogName ( )
pure virtual

Retrieves the output log file name.

Returns
- the output log file name
virtual int Longevity ( )
inlinevirtual

Returns the conditions under which the log is deleted.

Returns
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).
188 { return logDays; }
DWORD logDays
Definition: log.h:97
virtual void SetLongevity ( int  type)
inlinevirtual

Sets the conditions under which the log is deleted.

Parameters
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).
196 { logDays = days; }
DWORD logDays
Definition: log.h:97
virtual DWORD LogDays ( )
inlinevirtual

Returns the conditions under which the log is cleared.

Returns
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).
201 { logSize = size; }
DWORD logSize
Definition: log.h:98
virtual DWORD LogSize ( )
inlinevirtual

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

virtual void SetLogDays ( DWORD  days)
inlinevirtual

Set the number of days the log is maintained.

Parameters
days- The number of days to maintain the log. After this many days after creation the log is deleted.
virtual void SetLogSize ( DWORD  size)
inlinevirtual

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

After this size is reached the log file is deleted.

Parameters
size- The maximum size in kilobytes (KB) of the log file.
virtual void SaveState ( void  )
pure virtual
Remarks
This method is used internally.
virtual void LoadState ( void  )
pure virtual
Remarks
This method is used internally.

Member Data Documentation

DWORD valTypes
protected
int logLife
protected
DWORD logDays
protected
DWORD logSize
protected