cLogs Property Reference
File Configuration Properties
LogDir
Root directory for log files.
Public LogDir As StringDefault: Empty string (uses program directory)
Example:
' 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.
Public LogSubDir As StringDefault: "system"
Example:
' 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.
Public LogFileNameRule As EnumLogFileNameRuleEnum Values:
| Value | Constant | Description | Example Path |
|---|---|---|---|
| 0 | None | Use user-defined name | logs/system/vb.txt |
| 1 | ByMonth | Split by month | logs/system/2026/202601.txt |
| 2 | ByDay | Split by day | logs/system/2026/01/20260115.txt |
| 3 | byUser | Fully user-defined | Uses LogFileNameByUer |
Example:
' 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).
Public LogFileNameByUer As StringDescription: Used when LogFileNameRule = byUser or None
Example:
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.txtChannel Switch Properties
SendToFormView
Whether to output to form ListBox.
Public SendToFormView As BooleanRelated properties:
FormListBox- Target ListBox objectFormListBoxMaxItem- Maximum kept items
Example:
Set Log.FormListBox = Form1.List1
Log.FormListBoxMaxItem = 1000
Log.SendToFormView = True
Log.Data "This will appear in List1"SendToDbgView
Whether to output to DbgView.
Public SendToDbgView As BooleanExample:
Log.SendToDbgView = True
Log.Data "Debug info", "DEBUG"
' Visible in DbgViewSendToWebView
Whether to output to web remote debugging.
Public SendToWebView As BooleanRelated property: WebUserCode
Example:
Log.WebUserCode = "abc123"
Log.SendToWebView = True
Log.Data "Remote log"Log Control Properties
LogLevelControl
Log level control threshold.
Public LogLevelControl As EnumLogLevelDescription: Only logs entries greater than or equal to this level are recorded
Example:
' Production: Only log warnings and above
Log.LogLevelControl = LvWarn
' Debug: Log everything
Log.LogLevelControl = LvInfo
' Error tracking: Only log errors
Log.LogLevelControl = LvErrorForm-Related Properties
FormListBox
Target ListBox control.
Public FormListBox As VB.ListBoxExample:
' Bind to ListBox on form
Set Log.FormListBox = Form1.List1
' Or main form's list
Set Log.FormListBox = MainForm.LogListFormListBoxMaxItem
Maximum kept items in ListBox.
Public FormListBoxMaxItem As LongDefault: 999
Description: Automatically removes oldest entries when exceeding this count
Example:
Log.FormListBoxMaxItem = 500 ' Keep last 500 entries
Log.FormListBoxMaxItem = 100 ' Keep last 100 entriesShowLogsViewer
Show/hide built-in log viewer window.
Public Property Get ShowLogsViewer() As Boolean
Public Property Let ShowLogsViewer(Value As Boolean)Example:
' Show log window
Log.ShowLogsViewer = True
' Hide log window
Log.ShowLogsViewer = False
' Toggle visibility
Log.ShowLogsViewer = Not Log.ShowLogsViewerRemote Debugging Properties
WebUserCode
Web remote debugging user identification code.
Public WebUserCode As StringHow to get:
- Visit http://log.vb6.pro
- Get random string or set your own identification code
- Fill in this property
Example:
Log.WebUserCode = "myapp-123"
Log.WebUserCode = "550e8400-e29b-41d4-a716-446655440000"Other Properties
CacheDatas
Log cache collection (read-only).
Public CacheDatas As New CollectionDescription: Written to file and cleared when Save() is called
DebugPring
Debug print switch.
Public DebugPring As BooleanDescription: Output to Immediate window in IDE
Complete Configuration Example
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.SaveLast Updated: 2026-05-17