feat(logger): protocol-layer observability for highway and msg-push
Highway upload path now emits per-type entry + shared pipeline ops: DEBUG [Highway.Image] uploading 234567 bytes md5=abc12345... → group 12345 DEBUG [Highway] image OIDB requires bytes, PUT 234567 bytes (sub=top) DEBUG [Highway] image PUT done in 1234ms -- or -- DEBUG [Highway] image fast-upload hit (server already had bytes) The three pipeline-side lines come from runNtv2Upload() and are shared across image/video/ptt; the per-type entry log lives in each *-upload.ts wrapper so the scope identifies the media kind. md5 is truncated to its first 8 hex chars for line width; PUT latency is reported in ms. MsgPush silent dispatch defaults are now visible at debug: DEBUG [MsgPush.Unknown] no decoder for PkgType=999 subType=0 DEBUG [MsgPush.Unknown] Event0x2DC unknown subType=42 DEBUG [MsgPush.Unknown] Event0x210 unknown subType=42 Captures protocol drift (new NT QQ subtypes) and "we forgot to register this PkgType" oversights, neither of which used to leave any trace in the log. All new lines are debug-level so console output (default info) stays unchanged; file transport sees them for post-mortem.
This commit is contained in:
8 files changed
+266
-6
No files matched your search
@@ -7,6 +7,7 @@
|
||||
|
||||
import type { Bridge } from '../bridge';
|
||||
import type { MessageElement } from '../events';
|
||||
import { createLogger } from '../../utils/logger';
|
||||
import { GROUP_IMAGE_CMD_ID, PRIVATE_IMAGE_CMD_ID } from './highway-client';
|
||||
import {
|
||||
finalizeMediaMsgInfo,
|
||||
@@ -16,6 +17,14 @@ import {
|
||||
} from './pipeline';
|
||||
import { computeHashes, detectImageFormat, loadBinarySource } from './utils';
|
||||
|
||||
const moduleLog = createLogger('Highway.Image');
|
||||
|
||||
function loggerFor(bridge: Bridge) {
|
||||
const raw = bridge.identity?.uin;
|
||||
const uin = typeof raw === 'string' ? Number.parseInt(raw, 10) : 0;
|
||||
return Number.isFinite(uin) && uin > 0 ? moduleLog.child({ uin }) : moduleLog;
|
||||
}
|
||||
|
||||
interface ImageData {
|
||||
/** Empty when the caller is forwarding from cached fingerprints. */
|
||||
bytes: Uint8Array;
|
||||
@@ -106,7 +115,13 @@ export async function uploadImageMsgInfo(
|
||||
targetIdOrUid: string | number,
|
||||
element: MessageElement,
|
||||
): Promise<Uint8Array> {
|
||||
const log = loggerFor(bridge);
|
||||
const image = await loadImage(element);
|
||||
log.debug('uploading %d bytes md5=%s... → %s %s',
|
||||
image.fileSize,
|
||||
image.md5Hex.slice(0, 8),
|
||||
isGroup ? 'group' : 'c2c',
|
||||
String(targetIdOrUid));
|
||||
|
||||
const uploads: MediaSubFileUpload[] = [{
|
||||
source: 'top',
|
||||
|
||||
Reference in new issue
Block a user