Skip to content

Commit

Permalink
make Logger.prettyLogger the default logger (#3197)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Jul 10, 2024
1 parent e67c75d commit 47b435a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-peas-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": major
---

make Logger.prettyLogger the default logger
5 changes: 5 additions & 0 deletions .changeset/poor-tools-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": minor
---

add Logger.string Layer, for setting the logger to Logger.stringLogger
4 changes: 2 additions & 2 deletions packages/effect/src/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ export const json: Layer.Layer<never> = replace(fiberRuntime.defaultLogger, fibe
export const logFmt: Layer.Layer<never> = replace(fiberRuntime.defaultLogger, fiberRuntime.logFmtLogger)

/**
* @since 3.5.0
* @since 4.0.0
* @category constructors
*/
export const pretty: Layer.Layer<never> = replace(fiberRuntime.defaultLogger, fiberRuntime.prettyLogger)
export const string: Layer.Layer<never> = replace(fiberRuntime.defaultLogger, fiberRuntime.stringLogger)

/**
* @since 2.0.0
Expand Down
8 changes: 4 additions & 4 deletions packages/effect/src/internal/fiberRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ export const loggerWithConsoleError = <M, O>(self: Logger<M, O>): Logger<M, void
/** @internal */
export const defaultLogger: Logger<unknown, void> = globalValue(
Symbol.for("effect/Logger/defaultLogger"),
() => loggerWithConsoleLog(internalLogger.stringLogger)
() => internalLogger.prettyLogger()
)

/** @internal */
Expand All @@ -1422,9 +1422,9 @@ export const logFmtLogger: Logger<unknown, void> = globalValue(
)

/** @internal */
export const prettyLogger: Logger<unknown, void> = globalValue(
Symbol.for("effect/Logger/prettyLogger"),
() => internalLogger.prettyLogger()
export const stringLogger: Logger<unknown, void> = globalValue(
Symbol.for("effect/Logger/stringLogger"),
() => loggerWithConsoleLog(internalLogger.stringLogger)
)

/** @internal */
Expand Down

0 comments on commit 47b435a

Please sign in to comment.