-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 include required driver configuration
identifier
(#54)
* feat: 🎸 add "identifier" as a default driver configuration * fix: 🐛 remove cyclic dependencies * feat: 🎸 make identifier opt in forRoot http and console drivers * style: lint and format * chore: apply PR suggestions Co-authored-by: Lars Gyrup Brink Nielsen <larsbrinknielsen@gmail.com> * fix: 🐛 clean previous commit issues * feat: 🎸 extract driver identifiers into a separate file * refactor: 💡 rename http-driver-config files for better dev-exp * feat: 🎸 use the driver identifier when logging driver errors * refactor: 💡 move default identifier to a static driver field * refactor: 💡 move factory functions to driver root module * test: 💍 fix circular dependencies that broke tests * fix: 🐛 expect the right config in the forRoot method * test: 💍 revert to createHttpConfig method name Co-authored-by: Lars Gyrup Brink Nielsen <larsbrinknielsen@gmail.com>
- Loading branch information
1 parent
50f2b6e
commit 7fc96eb
Showing
39 changed files
with
307 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
libs/internal/test-util/src/lib/noop-driver/noop-driver-config.token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { inject, InjectionToken } from '@angular/core'; | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
import { LumberjackLogDriverConfig, lumberjackLogDriverConfigToken } from '@ngworker/lumberjack'; | ||
export const noopDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__NO-OP_DRIVER_CONFIG__', { | ||
factory: () => inject(lumberjackLogDriverConfigToken), | ||
}); | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export const noopDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__NO-OP_DRIVER_CONFIG__'); |
21 changes: 19 additions & 2 deletions
21
libs/internal/test-util/src/lib/noop-driver/noop-driver-root.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
libs/internal/test-util/src/lib/noop-driver/noop-driver.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export type NoopDriverConfig = Omit<LumberjackLogDriverConfig, 'identifier'> & | ||
Partial<Pick<LumberjackLogDriverConfig, 'identifier'>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
libs/internal/test-util/src/lib/object-driver/object-driver-config.token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { inject, InjectionToken } from '@angular/core'; | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
import { LumberjackLogDriverConfig, lumberjackLogDriverConfigToken } from '@ngworker/lumberjack'; | ||
export const objectDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__OBJECT_DRIVER_CONFIG__', { | ||
factory: () => inject(lumberjackLogDriverConfigToken), | ||
}); | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export const objectDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__OBJECT_DRIVER_CONFIG__'); |
23 changes: 21 additions & 2 deletions
23
libs/internal/test-util/src/lib/object-driver/object-driver-root.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
libs/internal/test-util/src/lib/object-driver/object-driver.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export type ObjectDriverConfig = Omit<LumberjackLogDriverConfig, 'identifier'> & | ||
Partial<Pick<LumberjackLogDriverConfig, 'identifier'>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
libs/internal/test-util/src/lib/spy-driver/spy-driver-config.token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import { inject, InjectionToken } from '@angular/core'; | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
import { LumberjackLogDriverConfig, lumberjackLogDriverConfigToken } from '@ngworker/lumberjack'; | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export const spyDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__SPY_DRIVER_CONFIG__', { | ||
factory: () => inject(lumberjackLogDriverConfigToken), | ||
}); | ||
export const spyDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__SPY_DRIVER_CONFIG__'); |
21 changes: 19 additions & 2 deletions
21
libs/internal/test-util/src/lib/spy-driver/spy-driver-root.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
libs/internal/test-util/src/lib/spy-driver/spy-driver.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export type SpyDriverConfig = Omit<LumberjackLogDriverConfig, 'identifier'> & | ||
Partial<Pick<LumberjackLogDriverConfig, 'identifier'>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
...lumberjack/console-driver/src/lib/configuration/lumberjack-console-driver-config.token.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import { inject, InjectionToken } from '@angular/core'; | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
import { LumberjackLogDriverConfig, lumberjackLogDriverConfigToken } from '@ngworker/lumberjack'; | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export const lumberjackConsoleDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>( | ||
'__LUMBERJACK_CONSOLE_DRIVER_CONFIG__', | ||
{ | ||
factory: () => inject(lumberjackLogDriverConfigToken), | ||
} | ||
'__LUMBERJACK_CONSOLE_DRIVER_CONFIG__' | ||
); |
25 changes: 23 additions & 2 deletions
25
.../lumberjack/console-driver/src/lib/configuration/lumberjack-console-driver-root.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...orker/lumberjack/console-driver/src/lib/configuration/lumberjack-console-driver.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { LumberjackLogDriverConfig } from '@ngworker/lumberjack'; | ||
|
||
export type LumberjackConsoleDriverConfig = Omit<LumberjackLogDriverConfig, 'identifier'> & | ||
Partial<Pick<LumberjackLogDriverConfig, 'identifier'>>; |
Oops, something went wrong.