@siteed/expo-audio-stream 1.3.0 → 1.4.0

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/android/build/.transforms/0588d516016bbd2e5b51abc80cc3d78d/transformed/classes/classes_dex/classes.dex +0 -0
  3. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  4. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  5. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  6. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  7. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  8. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  9. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  10. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  11. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  12. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  13. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  14. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  15. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  16. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  17. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  18. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  19. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  20. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  21. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  22. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  23. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
  24. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  25. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  26. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  27. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.s +1 -0
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  43. package/android/build.gradle +13 -5
  44. package/build/AudioAnalysis/extractAudioAnalysis.d.ts +3 -1
  45. package/build/AudioAnalysis/extractAudioAnalysis.d.ts.map +1 -1
  46. package/build/AudioAnalysis/extractAudioAnalysis.js +9 -11
  47. package/build/AudioAnalysis/extractAudioAnalysis.js.map +1 -1
  48. package/build/AudioAnalysis/extractWaveform.d.ts.map +1 -1
  49. package/build/AudioAnalysis/extractWaveform.js +0 -3
  50. package/build/AudioAnalysis/extractWaveform.js.map +1 -1
  51. package/build/ExpoAudioStream.types.d.ts +6 -0
  52. package/build/ExpoAudioStream.types.d.ts.map +1 -1
  53. package/build/ExpoAudioStream.types.js.map +1 -1
  54. package/build/ExpoAudioStream.web.d.ts +4 -2
  55. package/build/ExpoAudioStream.web.d.ts.map +1 -1
  56. package/build/ExpoAudioStream.web.js +6 -6
  57. package/build/ExpoAudioStream.web.js.map +1 -1
  58. package/build/WebRecorder.web.d.ts +4 -2
  59. package/build/WebRecorder.web.d.ts.map +1 -1
  60. package/build/WebRecorder.web.js +14 -13
  61. package/build/WebRecorder.web.js.map +1 -1
  62. package/build/events.d.ts.map +1 -1
  63. package/build/events.js +0 -4
  64. package/build/events.js.map +1 -1
  65. package/build/useAudioRecorder.d.ts +3 -3
  66. package/build/useAudioRecorder.d.ts.map +1 -1
  67. package/build/useAudioRecorder.js +26 -28
  68. package/build/useAudioRecorder.js.map +1 -1
  69. package/build/utils/convertPCMToFloat32.d.ts +3 -1
  70. package/build/utils/convertPCMToFloat32.d.ts.map +1 -1
  71. package/build/utils/convertPCMToFloat32.js +3 -5
  72. package/build/utils/convertPCMToFloat32.js.map +1 -1
  73. package/package.json +1 -3
  74. package/plugin/src/index.ts +5 -4
  75. package/src/AudioAnalysis/extractAudioAnalysis.ts +13 -13
  76. package/src/AudioAnalysis/extractWaveform.ts +0 -3
  77. package/src/ExpoAudioStream.types.ts +7 -0
  78. package/src/ExpoAudioStream.web.ts +8 -6
  79. package/src/WebRecorder.web.ts +15 -14
  80. package/src/events.ts +0 -4
  81. package/src/useAudioRecorder.tsx +32 -36
  82. package/src/utils/convertPCMToFloat32.ts +5 -5
  83. package/build/logger.d.ts +0 -9
  84. package/build/logger.d.ts.map +0 -1
  85. package/build/logger.js +0 -13
  86. package/build/logger.js.map +0 -1
  87. package/src/logger.ts +0 -22
@@ -1,5 +1,5 @@
1
1
  // src/useAudioRecorder.ts
2
- import { Platform, EventSubscription } from 'expo-modules-core'
2
+ import { EventSubscription, Platform } from 'expo-modules-core'
3
3
  import { useCallback, useEffect, useReducer, useRef } from 'react'
4
4
 
5
5
  import { AudioAnalysis } from './AudioAnalysis/AudioAnalysis.types'
@@ -7,6 +7,7 @@ import {
7
7
  AudioDataEvent,
8
8
  AudioRecording,
9
9
  AudioStreamStatus,
10
+ ConsoleLike,
10
11
  RecordingConfig,
11
12
  StartRecordingResult,
12
13
  } from './ExpoAudioStream.types'
@@ -16,12 +17,9 @@ import {
16
17
  addAudioEventListener,
17
18
  AudioEventPayload,
18
19
  } from './events'
19
- import { getLogger } from './logger'
20
20
 
21
- const TAG = 'useAudioRecorder'
22
- const logger = getLogger(TAG)
23
21
  export interface UseAudioRecorderProps {
24
- debug?: boolean
22
+ logger?: ConsoleLike
25
23
  audioWorkletUrl?: string
26
24
  featuresExtratorUrl?: string
27
25
  }
@@ -122,7 +120,7 @@ interface HandleAudioAnalysisProps {
122
120
  }
123
121
 
124
122
  export function useAudioRecorder({
125
- debug = false,
123
+ logger,
126
124
  audioWorkletUrl,
127
125
  featuresExtratorUrl,
128
126
  }: UseAudioRecorderProps = {}): UseAudioRecorderState {
@@ -141,12 +139,15 @@ export function useAudioRecorder({
141
139
  const fullAnalysisRef = useRef<AudioAnalysis>({
142
140
  ...defaultAnalysis,
143
141
  })
144
- const globalIdRef = useRef(0);
145
142
 
146
143
  // Instantiate the module for web with URLs
147
144
  const ExpoAudioStream =
148
145
  Platform.OS === 'web'
149
- ? ExpoAudioStreamModule({ audioWorkletUrl, featuresExtratorUrl })
146
+ ? ExpoAudioStreamModule({
147
+ audioWorkletUrl,
148
+ featuresExtratorUrl,
149
+ logger,
150
+ })
150
151
  : ExpoAudioStreamModule
151
152
 
152
153
  const onAudioStreamRef = useRef<
@@ -164,7 +165,7 @@ export function useAudioRecorder({
164
165
 
165
166
  const maxDuration = visualizationDuration
166
167
 
167
- logger.debug(
168
+ logger?.debug(
168
169
  `[handleAudioAnalysis] Received audio analysis: maxDuration=${maxDuration} analysis.dataPoints=${analysis.dataPoints.length} analysisData.dataPoints=${savedAnalysisData.dataPoints.length}`,
169
170
  analysis
170
171
  )
@@ -186,7 +187,7 @@ export function useAudioRecorder({
186
187
  const maxDataPoints =
187
188
  (pointsPerSecond * visualizationDuration) / 1000
188
189
 
189
- logger.debug(
190
+ logger?.debug(
190
191
  `[handleAudioAnalysis] Combined data points before trimming: pointsPerSecond=${pointsPerSecond} visualizationDuration=${visualizationDuration} combinedDataPointsLength=${combinedDataPoints.length} vs maxDataPoints=${maxDataPoints}`
191
192
  )
192
193
 
@@ -230,7 +231,7 @@ export function useAudioRecorder({
230
231
  max: newMax,
231
232
  }
232
233
 
233
- logger.debug(
234
+ logger?.debug(
234
235
  `[handleAudioAnalysis] Updated analysis data: durationMs=${savedAnalysisData.durationMs}`,
235
236
  savedAnalysisData
236
237
  )
@@ -261,7 +262,7 @@ export function useAudioRecorder({
261
262
  mimeType,
262
263
  buffer,
263
264
  } = eventData
264
- logger.debug(`[handleAudioEvent] Received audio event:`, {
265
+ logger?.debug(`[handleAudioEvent] Received audio event:`, {
265
266
  fileUri,
266
267
  deltaSize,
267
268
  totalSize,
@@ -280,7 +281,7 @@ export function useAudioRecorder({
280
281
  if (Platform.OS !== 'web') {
281
282
  // Read the audio file as a base64 string for comparison
282
283
  if (!encoded) {
283
- console.error(`${TAG} Encoded audio data is missing`)
284
+ logger?.error(`Encoded audio data is missing`)
284
285
  throw new Error('Encoded audio data is missing')
285
286
  }
286
287
  onAudioStreamRef.current?.({
@@ -300,13 +301,13 @@ export function useAudioRecorder({
300
301
  totalSize,
301
302
  }
302
303
  onAudioStreamRef.current?.(webEvent)
303
- logger.debug(
304
+ logger?.debug(
304
305
  `[handleAudioEvent] Audio data sent to onAudioStream`,
305
306
  webEvent
306
307
  )
307
308
  }
308
309
  } catch (error) {
309
- console.error(`${TAG} Error processing audio event:`, error)
310
+ logger?.error(`Error processing audio event:`, error)
310
311
  }
311
312
  },
312
313
  []
@@ -315,11 +316,9 @@ export function useAudioRecorder({
315
316
  const checkStatus = useCallback(async () => {
316
317
  try {
317
318
  const status: AudioStreamStatus = ExpoAudioStream.status()
318
- if (debug) {
319
- logger.debug(
320
- `Status: paused: ${status.isPaused} durationMs: ${status.durationMs} size: ${status.size}`
321
- )
322
- }
319
+ logger?.debug(
320
+ `Status: paused: ${status.isPaused} durationMs: ${status.durationMs} size: ${status.size}`
321
+ )
323
322
 
324
323
  // Check and update recording state
325
324
  if (
@@ -349,13 +348,13 @@ export function useAudioRecorder({
349
348
  })
350
349
  }
351
350
  } catch (error) {
352
- console.error(`${TAG} Error getting status:`, error)
351
+ logger?.error(`Error getting status:`, error)
353
352
  }
354
353
  }, [state.isRecording])
355
354
 
356
355
  const startRecording = useCallback(
357
356
  async (recordingOptions: RecordingConfig) => {
358
- logger.debug(`start recoding`, recordingOptions)
357
+ logger?.debug(`start recoding`, recordingOptions)
359
358
 
360
359
  analysisRef.current = { ...defaultAnalysis } // Reset analysis data
361
360
  fullAnalysisRef.current = { ...defaultAnalysis }
@@ -366,10 +365,7 @@ export function useAudioRecorder({
366
365
  if (typeof onAudioStream === 'function') {
367
366
  onAudioStreamRef.current = onAudioStream
368
367
  } else {
369
- console.warn(
370
- `${TAG} onAudioStream is not a function`,
371
- onAudioStream
372
- )
368
+ logger?.warn(`onAudioStream is not a function`, onAudioStream)
373
369
  onAudioStreamRef.current = null
374
370
  }
375
371
  const startResult: StartRecordingResult =
@@ -377,7 +373,7 @@ export function useAudioRecorder({
377
373
  dispatch({ type: 'START' })
378
374
 
379
375
  if (enableProcessing) {
380
- logger.debug(`Enabling audio analysis listener`)
376
+ logger?.debug(`Enabling audio analysis listener`)
381
377
  const listener = addAudioAnalysisListener(
382
378
  async (analysisData) => {
383
379
  try {
@@ -386,8 +382,8 @@ export function useAudioRecorder({
386
382
  visualizationDuration: maxRecentDataDuration,
387
383
  })
388
384
  } catch (error) {
389
- console.warn(
390
- `${TAG} Error processing audio analysis:`,
385
+ logger?.warn(
386
+ `Error processing audio analysis:`,
391
387
  error
392
388
  )
393
389
  }
@@ -403,7 +399,7 @@ export function useAudioRecorder({
403
399
  )
404
400
 
405
401
  const stopRecording = useCallback(async () => {
406
- logger.debug(`stoping recording`)
402
+ logger?.debug(`stoping recording`)
407
403
 
408
404
  const stopResult: AudioRecording = await ExpoAudioStream.stopRecording()
409
405
  stopResult.analysisData = fullAnalysisRef.current
@@ -413,20 +409,20 @@ export function useAudioRecorder({
413
409
  analysisListenerRef.current = null
414
410
  }
415
411
  onAudioStreamRef.current = null
416
- logger.debug(`recording stopped`, stopResult)
412
+ logger?.debug(`recording stopped`, stopResult)
417
413
  dispatch({ type: 'STOP' })
418
414
  return stopResult
419
415
  }, [dispatch])
420
416
 
421
417
  const pauseRecording = useCallback(async () => {
422
- logger.debug(`pause recording`)
418
+ logger?.debug(`pause recording`)
423
419
  const pauseResult = await ExpoAudioStream.pauseRecording()
424
420
  dispatch({ type: 'PAUSE' })
425
421
  return pauseResult
426
422
  }, [dispatch])
427
423
 
428
424
  const resumeRecording = useCallback(async () => {
429
- logger.debug(`resume recording`)
425
+ logger?.debug(`resume recording`)
430
426
  const resumeResult = await ExpoAudioStream.resumeRecording()
431
427
  dispatch({ type: 'RESUME' })
432
428
  return resumeResult
@@ -445,10 +441,10 @@ export function useAudioRecorder({
445
441
  }, [checkStatus, state.isRecording, state.isPaused])
446
442
 
447
443
  useEffect(() => {
448
- logger.debug(`Registering audio event listener`)
444
+ logger?.debug(`Registering audio event listener`)
449
445
  const subscribeAudio = addAudioEventListener(handleAudioEvent)
450
446
 
451
- logger.debug(
447
+ logger?.debug(
452
448
  `Subscribed to audio event listener and analysis listener`,
453
449
  {
454
450
  subscribeAudio,
@@ -456,7 +452,7 @@ export function useAudioRecorder({
456
452
  )
457
453
 
458
454
  return () => {
459
- logger.debug(`Removing audio event listener`)
455
+ logger?.debug(`Removing audio event listener`)
460
456
  subscribeAudio.remove()
461
457
  }
462
458
  }, [handleAudioEvent, handleAudioAnalysis])
@@ -1,10 +1,8 @@
1
+ import { ConsoleLike } from '../ExpoAudioStream.types'
1
2
  import { getWavFileInfo, WavFileInfo } from './getWavFileInfo'
2
- import { getLogger } from '../logger'
3
3
 
4
4
  export const WAV_HEADER_SIZE = 44
5
5
 
6
- const logger = getLogger('convertPCMToFloat32')
7
-
8
6
  const convertSample = (
9
7
  dataView: DataView,
10
8
  offset: number,
@@ -35,13 +33,15 @@ export const convertPCMToFloat32 = async ({
35
33
  bitDepth,
36
34
  buffer,
37
35
  skipWavHeader = false,
36
+ logger,
38
37
  }: {
39
38
  buffer: ArrayBuffer
40
39
  bitDepth: number
41
40
  skipWavHeader?: boolean
41
+ logger?: ConsoleLike
42
42
  }): Promise<{ pcmValues: Float32Array; min: number; max: number }> => {
43
43
  try {
44
- logger.debug(
44
+ logger?.debug(
45
45
  `Converting PCM to Float32: bitDepth: ${bitDepth}, buffer.byteLength: ${buffer.byteLength}`
46
46
  )
47
47
  const dataView = new DataView(buffer)
@@ -69,7 +69,7 @@ export const convertPCMToFloat32 = async ({
69
69
 
70
70
  return { pcmValues: float32Array, min, max }
71
71
  } catch (error: unknown) {
72
- logger.error(`Error converting PCM to Float32`, error)
72
+ logger?.error(`Error converting PCM to Float32`, error)
73
73
  return { pcmValues: new Float32Array(), min: 0, max: 0 }
74
74
  }
75
75
  }
package/build/logger.d.ts DELETED
@@ -1,9 +0,0 @@
1
- type ConsoleLike = {
2
- log: (message: string, ...args: unknown[]) => void;
3
- debug: (message: string, ...args: unknown[]) => void;
4
- warn: (message: string, ...args: unknown[]) => void;
5
- error: (message: string, ...args: unknown[]) => void;
6
- };
7
- export declare const getLogger: (tag: string) => ConsoleLike;
8
- export {};
9
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAKA,KAAK,WAAW,GAAG;IACf,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IAClD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IACpD,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;IACnD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;CACvD,CAAA;AAED,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,WASvC,CAAA"}
package/build/logger.js DELETED
@@ -1,13 +0,0 @@
1
- // packages/expo-audio-stream/src/logger.ts
2
- import { getLogger as siteedGetLogger } from '@siteed/react-native-logger';
3
- import { DEBUG_NAMESPACE } from './constants';
4
- export const getLogger = (tag) => {
5
- const baseLogger = siteedGetLogger(`${DEBUG_NAMESPACE}:${tag}`);
6
- return {
7
- log: (...args) => baseLogger.log(...args),
8
- debug: (...args) => baseLogger.debug(...args),
9
- error: (...args) => baseLogger.error(...args),
10
- warn: (...args) => baseLogger.warn(...args),
11
- };
12
- };
13
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAS7C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAe,EAAE;IAClD,MAAM,UAAU,GAAG,eAAe,CAAC,GAAG,eAAe,IAAI,GAAG,EAAE,CAAC,CAAA;IAE/D,OAAO;QACH,GAAG,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAI,IAAkB,CAAC;QACnE,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,GAAI,IAAkB,CAAC;QACvE,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,GAAI,IAAkB,CAAC;QACvE,IAAI,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAI,IAAkB,CAAC;KACxE,CAAA;AACL,CAAC,CAAA","sourcesContent":["// packages/expo-audio-stream/src/logger.ts\nimport { getLogger as siteedGetLogger } from '@siteed/react-native-logger'\n\nimport { DEBUG_NAMESPACE } from './constants'\n\ntype ConsoleLike = {\n log: (message: string, ...args: unknown[]) => void\n debug: (message: string, ...args: unknown[]) => void\n warn: (message: string, ...args: unknown[]) => void\n error: (message: string, ...args: unknown[]) => void\n}\n\nexport const getLogger = (tag: string): ConsoleLike => {\n const baseLogger = siteedGetLogger(`${DEBUG_NAMESPACE}:${tag}`)\n\n return {\n log: (...args: unknown[]) => baseLogger.log(...(args as [unknown])),\n debug: (...args: unknown[]) => baseLogger.debug(...(args as [unknown])),\n error: (...args: unknown[]) => baseLogger.error(...(args as [unknown])),\n warn: (...args: unknown[]) => baseLogger.warn(...(args as [unknown])),\n }\n}\n"]}
package/src/logger.ts DELETED
@@ -1,22 +0,0 @@
1
- // packages/expo-audio-stream/src/logger.ts
2
- import { getLogger as siteedGetLogger } from '@siteed/react-native-logger'
3
-
4
- import { DEBUG_NAMESPACE } from './constants'
5
-
6
- type ConsoleLike = {
7
- log: (message: string, ...args: unknown[]) => void
8
- debug: (message: string, ...args: unknown[]) => void
9
- warn: (message: string, ...args: unknown[]) => void
10
- error: (message: string, ...args: unknown[]) => void
11
- }
12
-
13
- export const getLogger = (tag: string): ConsoleLike => {
14
- const baseLogger = siteedGetLogger(`${DEBUG_NAMESPACE}:${tag}`)
15
-
16
- return {
17
- log: (...args: unknown[]) => baseLogger.log(...(args as [unknown])),
18
- debug: (...args: unknown[]) => baseLogger.debug(...(args as [unknown])),
19
- error: (...args: unknown[]) => baseLogger.error(...(args as [unknown])),
20
- warn: (...args: unknown[]) => baseLogger.warn(...(args as [unknown])),
21
- }
22
- }