Visual Basic Reference

LogEvent Method

See Also    Example    Applies To

Logs an event in the application's log target. On Windows NT platforms, the method writes to the NT Event log. On Windows 95/98 platforms, the method writes to the file specified in the LogPath property; by default, if no file is specified, events will be written to a file named vbevents.log.

Syntax

object.LogEvent (logBuffer, eventType)

Part Description
object An object expression that evaluates to an object in the Applies To list.
logBuffer Required. String to be written to the log.
eventType Optional. A Long integer that specifies the type of event, as shown in Settings.

Settings

The settings for eventType are:

Constant Value Description
vbLogEventTypeError 1 Error.
vbLogEventTypeWarning 2 Warning.
vbLogEventTypeInformation 4 Information.

Remarks

Guidelines for logging are available in the Win32 SDK, and those guidelines should be followed when logging either to the NT Event log or the file specified in the LogPath property (on Windows 95/98 platforms).