cLogs Component Overview
Introduction
cLogs is a feature-rich logging component that supports multiple output channels, log level control, and batch cached writing. Suitable for debugging, runtime monitoring, error tracking, and more.
Features
| Feature | Description |
|---|---|
| Multi-channel Output | File, Form, DbgView, Web remote debugging |
| Log Levels | INFO/WARN/DANGER/ERROR/DEBUGGER five-level control |
| Batch Cache | Cache first, then batch write for better performance |
| Chainable API | Fluent API design |
| Flexible Config | Daily/monthly file splitting, custom directory structure |
| Remote Debugging | Real-time log push to web viewer |
Output Channels
┌─────────────────────────────────────────────────────────────┐
│ cLogs │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐│
│ │ File Log │ │ Form View │ │ DbgView │ │ Web View ││
│ │ Save() │ │ FormView │ │ ToDbgView │ │ ToWebView ││
│ └───────────┘ └───────────┘ └───────────┘ └───────────┘│
└─────────────────────────────────────────────────────────────┘Quick Start
Basic Usage
vb
Dim Log As New cLogs
' Simple logging
Log.Data "Application started"
Log.Save
' With title and level
Log.Data "Connection successful", "Database", LvInfo
Log.Save
' Chainable call
Log.Data("User login").DataLine("Username: admin").SaveMultiple Channels Output Simultaneously
vb
Dim Log As New cLogs
' Set Web debug code (get from http://log.vb6.pro)
Log.WebUserCode = "your-code-123"
' Enable all channels
Log.SendToFormView = True ' Output to ListBox
Log.SendToDbgView = True ' Output to DbgView
Log.SendToWebView = True ' Output to Web
' Log (auto outputs to all enabled channels)
Log.Data "System event", "INFO", LvInfo
Log.Save ' Save to fileConfigure Log File
vb
Dim Log As New cLogs
' Set log directory
Log.LogDir = "C:\MyApp\Logs"
' Set subdirectory (for module differentiation)
Log.LogSubDir = "database"
' Set filename rule
Log.LogFileNameRule = ByDay ' Daily split: 2026\01\20260115.txt
' Log.LogFileNameRule = ByMonth ' Monthly split: 2026\202601.txt
' Log
Log.Data "Query data"
Log.SaveUsing Log Viewer
vb
Dim Log As New cLogs
' Show built-in log viewer window
Log.ShowLogsViewer = True
' Or use chainable method
Log.View(True).Data("Log content").Save
' Close viewer
Log.ShowLogsViewer = FalseLog File Structure
' Daily split (ByDay)
logs/
└── system/
└── 2026/
└── 01/
├── 20260115.txt
└── 20260116.txt
' Monthly split (ByMonth)
logs/
└── system/
└── 2026/
├── 202601.txt
└── 202602.txtLog Format
::[2026/1/15 10:30:45] [INFO] Database
Connection successful
::[2026/1/15 10:31:12] [WARN] Network
Connection timeout, retrying...References
FLogs.frm- Log viewer form (optional)ToolsLogs.bas- Log level constants
Last Updated: 2026-05-17