* Creates a new Deno SDK instance. * @param options Configuration options for this SDK.
(options: DenoClientOptions)
| 26 | * @param options Configuration options for this SDK. |
| 27 | */ |
| 28 | public constructor(options: DenoClientOptions) { |
| 29 | options._metadata = options._metadata || {}; |
| 30 | options._metadata.sdk = options._metadata.sdk || { |
| 31 | name: 'sentry.javascript.deno', |
| 32 | packages: [ |
| 33 | { |
| 34 | name: 'denoland:sentry', |
| 35 | version: SDK_VERSION, |
| 36 | }, |
| 37 | ], |
| 38 | version: SDK_VERSION, |
| 39 | }; |
| 40 | |
| 41 | const serverName = options.serverName || getHostName(); |
| 42 | |
| 43 | const clientOptions: ServerRuntimeClientOptions = { |
| 44 | ...options, |
| 45 | platform: 'javascript', |
| 46 | runtime: { name: 'deno', version: Deno.version.deno }, |
| 47 | serverName, |
| 48 | }; |
| 49 | |
| 50 | super(clientOptions); |
| 51 | |
| 52 | if (this.getOptions().enableLogs) { |
| 53 | this._logOnExitFlushListener = () => { |
| 54 | _INTERNAL_flushLogsBuffer(this); |
| 55 | }; |
| 56 | |
| 57 | if (serverName) { |
| 58 | this.on('beforeCaptureLog', log => { |
| 59 | log.attributes = { |
| 60 | ...log.attributes, |
| 61 | 'server.address': serverName, |
| 62 | }; |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | globalThis.addEventListener('unload', this._logOnExitFlushListener); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /** @inheritDoc */ |
| 71 | // @ts-expect-error - PromiseLike is a subset of Promise |
nothing calls this directly
no test coverage detected