sloplog 0.0.6 → 0.0.7

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.
@@ -9,12 +9,6 @@ export declare function truncateStack(stack: string | undefined): string | undef
9
9
  * Stack traces are automatically truncated.
10
10
  */
11
11
  export declare function flattenObject(obj: unknown, prefix?: string, result?: Record<string, unknown>): Record<string, unknown>;
12
- /**
13
- * Execute a function with all console methods suppressed.
14
- * Useful for preventing Sentry SDK from outputting its own logs to console
15
- * when we're already handling console output ourselves.
16
- */
17
- export declare function withSuppressedConsole<T>(fn: () => T): T;
18
12
  /**
19
13
  * Options passed to collectors when flushing an event
20
14
  */
@@ -49,39 +49,6 @@ export function flattenObject(obj, prefix = '', result = {}) {
49
49
  }
50
50
  return result;
51
51
  }
52
- /**
53
- * Execute a function with all console methods suppressed.
54
- * Useful for preventing Sentry SDK from outputting its own logs to console
55
- * when we're already handling console output ourselves.
56
- */
57
- export function withSuppressedConsole(fn) {
58
- /* eslint-disable no-console */
59
- const noop = () => { };
60
- const originalLog = console.log;
61
- const originalInfo = console.info;
62
- const originalWarn = console.warn;
63
- const originalError = console.error;
64
- const originalDebug = console.debug;
65
- const originalTrace = console.trace;
66
- console.log = noop;
67
- console.info = noop;
68
- console.warn = noop;
69
- console.error = noop;
70
- console.debug = noop;
71
- console.trace = noop;
72
- try {
73
- return fn();
74
- }
75
- finally {
76
- console.log = originalLog;
77
- console.info = originalInfo;
78
- console.warn = originalWarn;
79
- console.error = originalError;
80
- console.debug = originalDebug;
81
- console.trace = originalTrace;
82
- }
83
- /* eslint-enable no-console */
84
- }
85
52
  /**
86
53
  * Simple collector to log the event to stdout/console
87
54
  */
@@ -34,12 +34,6 @@ export interface SentryCollectorOptions {
34
34
  * Default: true
35
35
  */
36
36
  flattenAttributes?: boolean;
37
- /**
38
- * If true, suppress console output from Sentry SDK during logging.
39
- * Useful when you're already handling console output via another collector.
40
- * Default: true
41
- */
42
- suppressConsole?: boolean;
43
37
  }
44
38
  /**
45
39
  * Collector that sends events to Sentry Logs via the Sentry logger API.
@@ -55,7 +49,6 @@ export declare class SentryCollector implements LogCollectorClient {
55
49
  private levelSelector?;
56
50
  private message;
57
51
  private flattenAttributes;
58
- private suppressConsole;
59
52
  constructor(options: SentryCollectorOptions);
60
53
  flush(event: WideEventBase, partials: Map<string, PartialValue>, options: FlushOptions): Promise<void>;
61
54
  }
@@ -1,4 +1,4 @@
1
- import { flattenObject, withSuppressedConsole } from './index.js';
1
+ import { flattenObject } from './index.js';
2
2
  /**
3
3
  * Collector that sends events to Sentry Logs via the Sentry logger API.
4
4
  *
@@ -13,7 +13,6 @@ export class SentryCollector {
13
13
  levelSelector;
14
14
  message;
15
15
  flattenAttributes;
16
- suppressConsole;
17
16
  constructor(options) {
18
17
  // Support both direct logger and getter function for lazy initialization
19
18
  this.getLogger =
@@ -22,7 +21,6 @@ export class SentryCollector {
22
21
  this.levelSelector = options.levelSelector;
23
22
  this.message = options.message ?? 'wide-event';
24
23
  this.flattenAttributes = options.flattenAttributes ?? true;
25
- this.suppressConsole = options.suppressConsole ?? true;
26
24
  }
27
25
  async flush(event, partials, options) {
28
26
  const logger = this.getLogger();
@@ -57,13 +55,7 @@ export class SentryCollector {
57
55
  }
58
56
  logger.log?.(level, this.message, attributes);
59
57
  };
60
- // Suppress console output from Sentry SDK if configured
61
- if (this.suppressConsole) {
62
- withSuppressedConsole(logFn);
63
- }
64
- else {
65
- logFn();
66
- }
58
+ logFn();
67
59
  }
68
60
  }
69
61
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sloplog",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "A TypeScript library for constructing wide events",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",