2006年08月19日

ログ生成用クラス (3)

ログ生成用クラス (2) で使い方をご紹介した CoreLog クラスの実装を順にみていきましょう。 まずは最低限ということで、内部変数コンストラクタ 部分のみを抜き出してみます。
Public Class CoreLog
Private traceMaxLevel As Integer
Private logDoc As NotesDocument
Private itemDetail As NotesRichTextItem
Private itemTrace As NotesRichTextItem
Private timeStart As NotesDateTime

' ---- Constractor/Destractor methods ----

Sub New(doc As NotesDocument, level%, logType$)
Dim session As New NotesSession

If doc Is Nothing Then
Set Me.logDoc =
session.CurrentDatabase.CreateDocument
Me.logDoc.Form = "fLogCore"
Else
Set Me.logDoc = doc
End If
Set Me.timeStart = New NotesDateTime(Now())
Me.logDoc.Start = Me.timeStart.LSLocalTime
Me.logDoc.Executant = session.UserName
Me.logDoc.Status = "pending"
Me.logDoc.Type = logType$
Set Me.itemDetail =
createRichtextMember(logDoc, "Detail")
Set Me.itemTrace =
createRichtextMember(logDoc, "Trace")
Me.setTraceLevel(level%)
End Sub

Sub Delete
Delete Me.timeStart
End Sub

End Class

続きを読む
posted by yamachan at 00:02| Comment(0) | TrackBack(0) | my設計パターン