From 66781763261a1974a817698b502be14a678638d2 Mon Sep 17 00:00:00 2001 From: Ladd Date: Tue, 31 Dec 2024 12:40:26 -0600 Subject: [PATCH] prefix logs with rz: --- __tests__/run/001-single-node.ts | 1 + __tests__/run/002-two-nodes.ts | 4 ++-- src/collection.ts | 2 +- src/deltas.ts | 2 +- src/http/index.ts | 2 +- src/lossless.ts | 2 +- src/lossy.ts | 2 +- src/node.ts | 2 +- src/peers.ts | 2 +- src/pub-sub.ts | 2 +- src/request-reply.ts | 2 +- src/transactions.ts | 2 +- src/util/md-files.ts | 2 +- 13 files changed, 14 insertions(+), 13 deletions(-) diff --git a/__tests__/run/001-single-node.ts b/__tests__/run/001-single-node.ts index 50a9fbe..aad9f96 100644 --- a/__tests__/run/001-single-node.ts +++ b/__tests__/run/001-single-node.ts @@ -9,6 +9,7 @@ describe('Run', () => { httpEnable: true, requestBindPort: 5001, publishBindPort: 5002, + peerId: 'app-001', }); await app.start(); }); diff --git a/__tests__/run/002-two-nodes.ts b/__tests__/run/002-two-nodes.ts index 9c62161..5bebf55 100644 --- a/__tests__/run/002-two-nodes.ts +++ b/__tests__/run/002-two-nodes.ts @@ -8,11 +8,11 @@ describe('Run', () => { beforeAll(async () => { apps[0] = new App({ httpEnable: true, - peerId: 'app0', + peerId: 'app-002-A', }); apps[1] = new App({ httpEnable: true, - peerId: 'app1', + peerId: 'app-002-B', // Make the apps use the same pubsub topic so they can talk to each other pubSubTopic: apps[0].config.pubSubTopic, }); diff --git a/src/collection.ts b/src/collection.ts index 87edbc4..fbee74c 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -11,7 +11,7 @@ import {Entity, EntityProperties} from "./entity.js"; import {Lossy, ResolvedViewOne, Resolver} from "./lossy.js"; import {RhizomeNode} from "./node.js"; import {DomainEntityID} from "./types.js"; -const debug = Debug('collection'); +const debug = Debug('rz:collection'); export class Collection { rhizomeNode?: RhizomeNode; diff --git a/src/deltas.ts b/src/deltas.ts index 047ae9e..c92357e 100644 --- a/src/deltas.ts +++ b/src/deltas.ts @@ -3,7 +3,7 @@ import EventEmitter from 'node:events'; import objectHash from 'object-hash'; import {Delta, DeltaNetworkImage} from './delta.js'; import {RhizomeNode} from './node.js'; -const debug = Debug('deltas'); +const debug = Debug('rz:deltas'); enum Decision { Accept, diff --git a/src/http/index.ts b/src/http/index.ts index 9c726b9..39cfa5a 100644 --- a/src/http/index.ts +++ b/src/http/index.ts @@ -4,7 +4,7 @@ import {Server} from "http"; import {RhizomeNode} from "../node.js"; import {HttpApi} from "./api.js"; import {HttpHtml} from "./html.js"; -const debug = Debug('http-api'); +const debug = Debug('rz:http-api'); export class HttpServer { app = express(); diff --git a/src/lossless.ts b/src/lossless.ts index 6352bc4..fe8b27e 100644 --- a/src/lossless.ts +++ b/src/lossless.ts @@ -7,7 +7,7 @@ import {Delta, DeltaFilter, DeltaNetworkImage} from './delta.js'; import {Transactions} from './transactions.js'; import {DomainEntityID, PropertyID, PropertyTypes, TransactionID, ViewMany} from "./types.js"; import {RhizomeNode} from './node.js'; -const debug = Debug('lossless'); +const debug = Debug('rz:lossless'); export type CollapsedPointer = {[key: PropertyID]: PropertyTypes}; diff --git a/src/lossy.ts b/src/lossy.ts index 2fd7bf5..e231a51 100644 --- a/src/lossy.ts +++ b/src/lossy.ts @@ -9,7 +9,7 @@ import {DeltaFilter} from "./delta.js"; import {CollapsedDelta, Lossless, LosslessViewMany, LosslessViewOne} from "./lossless.js"; import {DomainEntityID, PropertyID, PropertyTypes, Timestamp, ViewMany} from "./types.js"; -// const debug = Debug('lossy'); +// const debug = Debug('rz:lossy'); type TimestampedProperty = { value: PropertyTypes, diff --git a/src/node.ts b/src/node.ts index c6e976e..9f64b35 100644 --- a/src/node.ts +++ b/src/node.ts @@ -7,7 +7,7 @@ import {Peers} from './peers.js'; import {PubSub} from './pub-sub.js'; import {RequestReply} from './request-reply.js'; import {PeerAddress} from './types.js'; -const debug = Debug('rhizome-node'); +const debug = Debug('rz:rhizome-node'); export type RhizomeNodeConfig = { requestBindAddr: string; diff --git a/src/peers.ts b/src/peers.ts index 997f0d2..059bf66 100644 --- a/src/peers.ts +++ b/src/peers.ts @@ -6,7 +6,7 @@ import {RhizomeNode} from "./node.js"; import {Subscription} from './pub-sub.js'; import {PeerRequest, RequestSocket, ResponseSocket} from "./request-reply.js"; import {PeerAddress} from "./types.js"; -const debug = Debug('peers'); +const debug = Debug('rz:peers'); export enum RequestMethods { GetPublishAddress, diff --git a/src/pub-sub.ts b/src/pub-sub.ts index 418b762..c09c76c 100644 --- a/src/pub-sub.ts +++ b/src/pub-sub.ts @@ -10,7 +10,7 @@ import {Libp2p, createLibp2p} from 'libp2p'; import {Publisher, Subscriber} from 'zeromq'; import {RhizomeNode} from './node.js'; import {PeerAddress} from './types.js'; -const debug = Debug('pub-sub'); +const debug = Debug('rz:pub-sub'); export type SubscribedMessageHandler = (sender: PeerAddress, msg: string) => void; diff --git a/src/request-reply.ts b/src/request-reply.ts index 176d986..5463af5 100644 --- a/src/request-reply.ts +++ b/src/request-reply.ts @@ -4,7 +4,7 @@ import {Message, Reply, Request} from 'zeromq'; import {RhizomeNode} from './node.js'; import {RequestMethods} from './peers.js'; import {PeerAddress} from './types.js'; -const debug = Debug('request-reply'); +const debug = Debug('rz:request-reply'); export type PeerRequest = { method: RequestMethods; diff --git a/src/transactions.ts b/src/transactions.ts index 4046311..04c4d53 100644 --- a/src/transactions.ts +++ b/src/transactions.ts @@ -3,7 +3,7 @@ import EventEmitter from "events"; import {Delta, DeltaID} from "./delta.js"; import {DomainEntityID, TransactionID} from "./types.js"; import {Lossless} from "./lossless.js"; -const debug = Debug("transactions"); +const debug = Debug('rz:transactions'); function getDeltaTransactionId(delta: Delta): TransactionID | undefined { const {target: transactionId} = delta.pointers.find(({ diff --git a/src/util/md-files.ts b/src/util/md-files.ts index f84b7c5..aea1a01 100644 --- a/src/util/md-files.ts +++ b/src/util/md-files.ts @@ -4,7 +4,7 @@ import path, {join} from "path"; import showdown from "showdown"; import {RhizomeNode} from "../node.js"; const {Converter} = showdown; -const debug = Debug('md-files'); +const debug = Debug('rz:md-files'); const docConverter = new Converter({ completeHTMLDocument: true,