@riddix/hamh 2.1.0-alpha.643 → 2.1.0-alpha.645

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148596,7 +148596,14 @@ function addLogEntry(entry) {
148596
148596
  function logsApi(_logger) {
148597
148597
  const router = express5.Router();
148598
148598
  router.get("/", (req, res) => {
148599
- const { level, search, limit = "100", offset = "0" } = req.query;
148599
+ const {
148600
+ level,
148601
+ search,
148602
+ category,
148603
+ facility,
148604
+ limit = "100",
148605
+ offset = "0"
148606
+ } = req.query;
148600
148607
  const limitNum = Math.min(
148601
148608
  500,
148602
148609
  Math.max(1, parseInt(limit, 10) || 100)
@@ -148607,6 +148614,18 @@ function logsApi(_logger) {
148607
148614
  const levels = level.split(",").map((l) => l.toLowerCase().trim());
148608
148615
  entries = entries.filter((e) => levels.includes(e.level.toLowerCase()));
148609
148616
  }
148617
+ if (category && typeof category === "string") {
148618
+ const cats = category.split(",").map((c) => c.toLowerCase().trim());
148619
+ entries = entries.filter(
148620
+ (e) => e.category != null && cats.includes(e.category.toLowerCase())
148621
+ );
148622
+ }
148623
+ if (facility && typeof facility === "string") {
148624
+ const facLower = facility.toLowerCase();
148625
+ entries = entries.filter(
148626
+ (e) => e.facility?.toLowerCase().includes(facLower)
148627
+ );
148628
+ }
148610
148629
  if (search && typeof search === "string") {
148611
148630
  const searchLower = search.toLowerCase();
148612
148631
  entries = entries.filter(
@@ -151608,6 +151627,17 @@ init_esm7();
151608
151627
 
151609
151628
  // src/core/app/logger.ts
151610
151629
  init_esm();
151630
+ var MATTER_TRAFFIC_FACILITIES = /* @__PURE__ */ new Set([
151631
+ "InteractionServer",
151632
+ "MessageExchange",
151633
+ "MessageChannel",
151634
+ "ServerSubscription",
151635
+ "IncomingInteractionServerMessenger",
151636
+ "ExchangeManager"
151637
+ ]);
151638
+ function categoryFor(facility) {
151639
+ return MATTER_TRAFFIC_FACILITIES.has(facility) ? "matter-traffic" : void 0;
151640
+ }
151611
151641
  function logLevelFromString(level) {
151612
151642
  const customNames = {
151613
151643
  SILLY: -1 /* SILLY */
@@ -151653,6 +151683,26 @@ var LoggerService = class {
151653
151683
  MessageExchange: resolvedProtocolLevel
151654
151684
  };
151655
151685
  Logger.format = options.disableColors ? LogFormat.PLAIN : LogFormat.ANSI;
151686
+ const destinationLevel = this.customLogLevelMapping[this._level] ?? this._level;
151687
+ Logger.destinations["hamh-buffer"] = LogDestination({
151688
+ name: "hamh-buffer",
151689
+ level: destinationLevel,
151690
+ facilityLevels: {
151691
+ MessageChannel: resolvedProtocolLevel,
151692
+ MessageExchange: resolvedProtocolLevel
151693
+ },
151694
+ write: (text, message) => {
151695
+ const category = categoryFor(message.facility);
151696
+ if (!category) return;
151697
+ addLogEntry({
151698
+ timestamp: message.now.toISOString(),
151699
+ level: logLevelToString(message.level).toLowerCase(),
151700
+ message: text,
151701
+ facility: message.facility,
151702
+ category
151703
+ });
151704
+ }
151705
+ });
151656
151706
  }
151657
151707
  get(nameOrService) {
151658
151708
  let name;