feat(logger): add [BAILEYS] console-friendly logging functions

Add formatted logging functions with [BAILEYS] prefix and emojis:
- logEventBuffer: buffer events (📦, 🔄, ⚠️, , 🧹, 🧠)
- logBufferMetrics: metrics display (📊)
- logMessageSent/Received: message events (📤, 📥)
- logConnection: connection events (🔌, , 🔴, 🔄, )
- logAuth: authentication events (📱, 🔑, 🚪, 🔐)
- logCircuitBreaker: circuit breaker state (, , 🔶)
- logRetry: retry attempts (🔁)
- logInfo/Warn/Error: generic messages (ℹ️, ⚠️, )
- logLidMapping: LID store events (🗂️, 🔍, 💾, 📦)

All functions respect BAILEYS_LOG=false environment variable.
Integrated into event-buffer.ts and messages-send/recv.ts.
This commit is contained in:
Claude
2026-01-20 20:48:26 +00:00
parent 44fb5997a1
commit 3f2ced4501
4 changed files with 408 additions and 0 deletions
+4
View File
@@ -12,6 +12,7 @@ import type {
WAMessage,
WAMessageKey
} from '../Types'
import { logMessageSent } from '../Utils/baileys-logger'
import {
aggregateMessageKeysNotFromMe,
assertMediaContent,
@@ -1034,6 +1035,9 @@ export const makeMessagesSocket = (config: SocketConfig) => {
await sendNode(stanza)
// Log with [BAILEYS] prefix
logMessageSent(msgId, destinationJid)
// Add message to retry cache if enabled
if (messageRetryManager && !participant) {
messageRetryManager.addRecentMessage(destinationJid, msgId, message)