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.
22 lines
486 B
TypeScript
22 lines
486 B
TypeScript
// src/lib/service.ts
|
|
// Copyright (C) 2026 Robert Colbert <rob.colbert@openplatform.us>
|
|
// All Rights Reserved
|
|
|
|
// import env from "../config/env.js";
|
|
|
|
import { GadgetComponent, GadgetLog } from "@gadget/api";
|
|
|
|
export abstract class DtpService implements GadgetComponent {
|
|
log: GadgetLog;
|
|
|
|
abstract get name(): string;
|
|
abstract get slug(): string;
|
|
|
|
constructor() {
|
|
this.log = new GadgetLog(this);
|
|
}
|
|
|
|
abstract start(): Promise<void>;
|
|
abstract stop(): Promise<void>;
|
|
}
|