Skip to content

cLogs Property Reference

File Configuration Properties

LogDir

Root directory for log files.

vb
Public LogDir As String

Default: Empty string (uses program directory)

Example:

vb
' Use logs folder under program directory (default)
Log.LogDir = ""

' Specify absolute path
Log.LogDir = "C:\MyApp\Logs"

' Use AppData directory
Log.LogDir = Environ("APPDATA") & "\MyApp\Logs"

LogSubDir

Log subdirectory for distinguishing business modules.

vb
Public LogSubDir As String

Default: "system"

Example:

vb
' Database module logs
Log.LogSubDir = "database"
' Output to: logs/database/...

' Network module logs
Log.LogSubDir = "network"
' Output to: logs/network/...

' User operation logs
Log.LogSubDir = "user"
' Output to: logs/user/...

LogFileNameRule

Log file naming rule.

vb
Public LogFileNameRule As EnumLogFileNameRule

Enum Values:

ValueConstantDescriptionExample Path
0NoneUse user-defined namelogs/system/vb.txt
1ByMonthSplit by monthlogs/system/2026/202601.txt
2ByDaySplit by daylogs/system/2026/01/20260115.txt
3byUserFully user-definedUses LogFileNameByUer

Example:

vb
' Split by day (recommended, file size moderate)
Log.LogFileNameRule = ByDay

' Split by month (small log volume)
Log.LogFileNameRule = ByMonth

' Custom file name
Log.LogFileNameRule = byUser
Log.LogFileNameByUer = "custom\mylog.txt"

LogFileNameByUer

User-defined log file name (complete relative path).

vb
Public LogFileNameByUer As String

Description: Used when LogFileNameRule = byUser or None

Example:

vb
Log.LogFileNameRule = byUser
Log.LogFileNameByUer = "custom\app.log"
' Output to: logs/custom/app.log

Log.LogFileNameByUer = "2026\january\debug.txt"
' Output to: logs/2026/january/debug.txt

Channel Switch Properties

SendToFormView

Whether to output to form ListBox.

vb
Public SendToFormView As Boolean

Related properties:

  • FormListBox - Target ListBox object
  • FormListBoxMaxItem - Maximum kept items

Example:

vb
Set Log.FormListBox = Form1.List1
Log.FormListBoxMaxItem = 1000
Log.SendToFormView = True

Log.Data "This will appear in List1"

SendToDbgView

Whether to output to DbgView.

vb
Public SendToDbgView As Boolean

Example:

vb
Log.SendToDbgView = True
Log.Data "Debug info", "DEBUG"
' Visible in DbgView

SendToWebView

Whether to output to web remote debugging.

vb
Public SendToWebView As Boolean

Related property: WebUserCode

Example:

vb
Log.WebUserCode = "abc123"
Log.SendToWebView = True
Log.Data "Remote log"

Log Control Properties

LogLevelControl

Log level control threshold.

vb
Public LogLevelControl As EnumLogLevel

Description: Only logs entries greater than or equal to this level are recorded

Example:

vb
' Production: Only log warnings and above
Log.LogLevelControl = LvWarn

' Debug: Log everything
Log.LogLevelControl = LvInfo

' Error tracking: Only log errors
Log.LogLevelControl = LvError

FormListBox

Target ListBox control.

vb
Public FormListBox As VB.ListBox

Example:

vb
' Bind to ListBox on form
Set Log.FormListBox = Form1.List1

' Or main form's list
Set Log.FormListBox = MainForm.LogList

FormListBoxMaxItem

Maximum kept items in ListBox.

vb
Public FormListBoxMaxItem As Long

Default: 999

Description: Automatically removes oldest entries when exceeding this count

Example:

vb
Log.FormListBoxMaxItem = 500   ' Keep last 500 entries
Log.FormListBoxMaxItem = 100   ' Keep last 100 entries

ShowLogsViewer

Show/hide built-in log viewer window.

vb
Public Property Get ShowLogsViewer() As Boolean
Public Property Let ShowLogsViewer(Value As Boolean)

Example:

vb
' Show log window
Log.ShowLogsViewer = True

' Hide log window
Log.ShowLogsViewer = False

' Toggle visibility
Log.ShowLogsViewer = Not Log.ShowLogsViewer

Remote Debugging Properties

WebUserCode

Web remote debugging user identification code.

vb
Public WebUserCode As String

How to get:

  1. Visit http://log.vb6.pro
  2. Get random string or set your own identification code
  3. Fill in this property

Example:

vb
Log.WebUserCode = "myapp-123"
Log.WebUserCode = "550e8400-e29b-41d4-a716-446655440000"

Other Properties

CacheDatas

Log cache collection (read-only).

vb
Public CacheDatas As New Collection

Description: Written to file and cleared when Save() is called


DebugPring

Debug print switch.

vb
Public DebugPring As Boolean

Description: Output to Immediate window in IDE


Complete Configuration Example

vb
Dim Log As New cLogs

' ========== File Configuration ==========
Log.LogDir = Environ("APPDATA") & "\MyApp\Logs"
Log.LogSubDir = "database"
Log.LogFileNameRule = ByDay

' ========== Form Output Configuration ==========
Set Log.FormListBox = MainForm.ListLog
Log.FormListBoxMaxItem = 1000
Log.SendToFormView = True

' ========== Remote Debug Configuration ==========
Log.WebUserCode = "myapp-debug-001"
Log.SendToWebView = True

' ========== Level Control ==========
Log.LogLevelControl = LvInfo  ' Log all levels

' ========== Log Entries ==========
Log.Data "Application started", "SYSTEM", LvInfo
Log.DataLine("Log system initialization complete")
Log.Save

Last Updated: 2026-05-17

VB6 and LOGO copyright of Microsoft Corporation