@dxos/client-services 0.1.51-main.04d9478 → 0.1.51-main.0e88376

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.
@@ -3566,8 +3566,7 @@ var DevicesServiceImpl = class {
3566
3566
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
3567
3567
  import { Event as Event7 } from "@dxos/async";
3568
3568
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
3569
- import { getContextFromEntry, log as log14 } from "@dxos/log";
3570
- import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
3569
+ import { log as log14, shouldLog, getContextFromEntry } from "@dxos/log";
3571
3570
  import { jsonify } from "@dxos/util";
3572
3571
  var LoggingServiceImpl = class {
3573
3572
  constructor() {
@@ -3584,60 +3583,31 @@ var LoggingServiceImpl = class {
3584
3583
  log14.runtimeConfig.processors.splice(index, 1);
3585
3584
  }
3586
3585
  queryLogs(request) {
3586
+ var _a;
3587
+ const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
3587
3588
  return new Stream11(({ ctx, next }) => {
3588
3589
  const handler = (entry2) => {
3589
- var _a, _b, _c, _d, _e;
3590
- if (LOG_PROCESSING > 0) {
3591
- return;
3592
- }
3593
- if (((_a = entry2.meta) == null ? void 0 : _a.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3594
- return;
3595
- }
3596
- if (!shouldLog(entry2, request)) {
3590
+ var _a2, _b, _c;
3591
+ if (((_a2 = entry2.meta) == null ? void 0 : _a2.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3597
3592
  return;
3598
3593
  }
3599
- const record = {
3600
- ...entry2,
3601
- context: jsonify(getContextFromEntry(entry2)),
3602
- timestamp: new Date(),
3603
- meta: {
3604
- // TODO(dmaretskyi): Fix proto.
3605
- file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
3606
- line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
3607
- }
3608
- };
3609
- try {
3610
- LOG_PROCESSING++;
3594
+ if (shouldLog(entry2, filters)) {
3595
+ const record = {
3596
+ ...entry2,
3597
+ context: jsonify(getContextFromEntry(entry2))
3598
+ };
3599
+ (_b = record.meta) == null ? true : delete _b.bugcheck;
3600
+ (_c = record.meta) == null ? true : delete _c.scope;
3611
3601
  next(record);
3612
- } finally {
3613
- LOG_PROCESSING--;
3614
3602
  }
3615
3603
  };
3616
- this._logs.on(ctx, handler);
3617
- });
3618
- }
3619
- };
3620
- var matchFilter = (filter, level, path, options) => {
3621
- switch (options) {
3622
- case QueryLogsRequest.MatchingOptions.INCLUSIVE:
3623
- return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
3624
- case QueryLogsRequest.MatchingOptions.EXPLICIT:
3625
- return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
3626
- }
3627
- };
3628
- var shouldLog = (entry2, request) => {
3629
- var _a;
3630
- const options = (_a = request.options) != null ? _a : QueryLogsRequest.MatchingOptions.INCLUSIVE;
3631
- if (request.filters === void 0) {
3632
- return options === QueryLogsRequest.MatchingOptions.INCLUSIVE;
3633
- } else {
3634
- return request.filters.some((filter) => {
3635
- var _a2, _b;
3636
- return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
3604
+ ctx.onDispose(() => {
3605
+ this._logs.off(handler);
3606
+ });
3607
+ this._logs.on(handler);
3637
3608
  });
3638
3609
  }
3639
3610
  };
3640
- var LOG_PROCESSING = 0;
3641
3611
 
3642
3612
  // packages/sdk/client-services/src/packlets/network/network-service.ts
3643
3613
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
@@ -3994,4 +3964,4 @@ export {
3994
3964
  ClientServicesHost,
3995
3965
  LocalClientServices
3996
3966
  };
3997
- //# sourceMappingURL=chunk-QUJROKKU.mjs.map
3967
+ //# sourceMappingURL=chunk-YPN5TDAA.mjs.map