Skip to content

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

FeatureDescription
Multi-channel OutputFile, Form, DbgView, Web remote debugging
Log LevelsINFO/WARN/DANGER/ERROR/DEBUGGER five-level control
Batch CacheCache first, then batch write for better performance
Chainable APIFluent API design
Flexible ConfigDaily/monthly file splitting, custom directory structure
Remote DebuggingReal-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").Save

Multiple 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 file

Configure 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.Save

Using 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 = False

Log File Structure

' Daily split (ByDay)
logs/
└── system/
    └── 2026/
        └── 01/
            ├── 20260115.txt
            └── 20260116.txt

' Monthly split (ByMonth)
logs/
└── system/
    └── 2026/
        ├── 202601.txt
        └── 202602.txt

Log 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

VB6 and LOGO copyright of Microsoft Corporation