effect 2.4.17 → 2.4.18

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.
@@ -1355,50 +1355,41 @@ export const currentMinimumLogLevel: FiberRef.FiberRef<LogLevel.LogLevel> = glob
1355
1355
  )
1356
1356
 
1357
1357
  /** @internal */
1358
- export const getConsole = (refs: FiberRefs.FiberRefs) => {
1359
- const defaultServicesValue = FiberRefs.getOrDefault(refs, defaultServices.currentServices)
1360
- const cnsl = Context.get(defaultServicesValue, consoleTag)
1361
- return cnsl.unsafe
1362
- }
1358
+ export const loggerWithConsoleLog = <M, O>(self: Logger<M, O>): Logger<M, void> =>
1359
+ internalLogger.makeLogger((opts) => {
1360
+ const services = FiberRefs.getOrDefault(opts.context, defaultServices.currentServices)
1361
+ Context.get(services, consoleTag).unsafe.log(self.log(opts))
1362
+ })
1363
+
1364
+ /** @internal */
1365
+ export const loggerWithConsoleError = <M, O>(self: Logger<M, O>): Logger<M, void> =>
1366
+ internalLogger.makeLogger((opts) => {
1367
+ const services = FiberRefs.getOrDefault(opts.context, defaultServices.currentServices)
1368
+ Context.get(services, consoleTag).unsafe.error(self.log(opts))
1369
+ })
1363
1370
 
1364
1371
  /** @internal */
1365
1372
  export const defaultLogger: Logger<unknown, void> = globalValue(
1366
1373
  Symbol.for("effect/Logger/defaultLogger"),
1367
- () =>
1368
- internalLogger.makeLogger((options) => {
1369
- const formatted = internalLogger.stringLogger.log(options)
1370
- getConsole(options.context).log(formatted)
1371
- })
1374
+ () => loggerWithConsoleLog(internalLogger.stringLogger)
1372
1375
  )
1373
1376
 
1374
1377
  /** @internal */
1375
1378
  export const jsonLogger: Logger<unknown, void> = globalValue(
1376
1379
  Symbol.for("effect/Logger/jsonLogger"),
1377
- () =>
1378
- internalLogger.makeLogger((options) => {
1379
- const formatted = internalLogger.jsonLogger.log(options)
1380
- getConsole(options.context).log(formatted)
1381
- })
1380
+ () => loggerWithConsoleLog(internalLogger.jsonLogger)
1382
1381
  )
1383
1382
 
1384
1383
  /** @internal */
1385
1384
  export const logFmtLogger: Logger<unknown, void> = globalValue(
1386
1385
  Symbol.for("effect/Logger/logFmtLogger"),
1387
- () =>
1388
- internalLogger.makeLogger((options) => {
1389
- const formatted = internalLogger.logfmtLogger.log(options)
1390
- getConsole(options.context).log(formatted)
1391
- })
1386
+ () => loggerWithConsoleLog(internalLogger.logfmtLogger)
1392
1387
  )
1393
1388
 
1394
1389
  /** @internal */
1395
1390
  export const structuredLogger: Logger<unknown, void> = globalValue(
1396
1391
  Symbol.for("effect/Logger/structuredLogger"),
1397
- () =>
1398
- internalLogger.makeLogger((options) => {
1399
- const formatted = internalLogger.structuredLogger.log(options)
1400
- getConsole(options.context).log(formatted)
1401
- })
1392
+ () => loggerWithConsoleLog(internalLogger.structuredLogger)
1402
1393
  )
1403
1394
 
1404
1395
  /** @internal */
@@ -1,4 +1,4 @@
1
- let moduleVersion = "2.4.17"
1
+ let moduleVersion = "2.4.18"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4