Программирование в IIS


Пример 1.6


'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'ProcessErr

'formats error and stores it in error local

'then write to event log. Event logging

'will not function in IDE - only in compiled.

'

'in: vsMessage - usually denoting function

'out: nothing

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Private Sub ProcessErr(ByVal vsMessage As String)

Const ERROR_SEPARATOR = " -- "

Const NOW_TIME_FORMAT = "yyyy mmm d hh:mm:ss"

Const A_SPACE = " "

Const ERROR_NUM = " Error #"

Const ERROR_BY = " was generated by "

Dim sDateTime As String

'get a time data stamp

sDateTime = CStr(Format(Now, NOW_TIME_FORMAT)) & _

ERROR_SEPARATOR

'construct the error entry

vsMessage = sDateTime & vsMessage

'add err object data to the error entry

m_sErrorMessage = vsMessage & ERROR_NUM & Err.Number _

& ERROR_BY & Err.Source & A_SPACE & Err.Description & vbCrLf

'write to event log

App.LogEvent m_sErrorMessage, vbLogEventTypeError

End Sub




Начало  Назад  Вперед



Книжный магазин