mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 15:30:39 +00:00
22 lines
727 B
TypeScript
22 lines
727 B
TypeScript
import { shouldLogVerbose } from "../../globals.js";
|
|
import { getChildLogger } from "../../logging.js";
|
|
import { normalizeLogLevel } from "../../logging/levels.js";
|
|
import type { PluginRuntime } from "./types.js";
|
|
|
|
export function createRuntimeLogging(): PluginRuntime["logging"] {
|
|
return {
|
|
shouldLogVerbose,
|
|
getChildLogger: (bindings, opts) => {
|
|
const logger = getChildLogger(bindings, {
|
|
level: opts?.level ? normalizeLogLevel(opts.level) : undefined,
|
|
});
|
|
return {
|
|
debug: (message) => logger.debug?.(message),
|
|
info: (message) => logger.info(message),
|
|
warn: (message) => logger.warn(message),
|
|
error: (message) => logger.error(message),
|
|
};
|
|
},
|
|
};
|
|
}
|