Move the 6 duplicated logging modules (component, log, log-transport, log-transport-console, log-transport-file, log-file) from both gadget-code (Dtp* prefix) and gadget-drone (Gadget* prefix) into @shad/api, using gadget-drone's GadgetLog as the canonical version. GadgetLog now uses static configuration (consoleEnabled, defaultFile) set by each consumer's env.ts at module scope, removing the env dependency from the shared library. The addDefaultTransport/ removeDefaultTransport/getDefaultTransports static methods are preserved for future real-time log transport injection.
20 lines
457 B
TypeScript
20 lines
457 B
TypeScript
// src/lib/redis.ts
|
|
// Copyright (C) 2026 Robert Colbert <rob.colbert@openplatform.us>
|
|
// All Rights Reserved
|
|
|
|
import env from "../config/env.js";
|
|
import { Redis } from "ioredis";
|
|
|
|
import { GadgetLog } from "@gadget/api";
|
|
const log = new GadgetLog({ name: "redis", slug: "redis" });
|
|
|
|
log.info("connecting to Redis", {
|
|
host: env.redis.host,
|
|
port: env.redis.port,
|
|
});
|
|
|
|
const redis = new Redis(env.redis);
|
|
redis.setMaxListeners(64);
|
|
|
|
export default redis;
|