Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: extract lumberjack core into an agnostic library #154

Closed
wants to merge 99 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
698cd12
feat: create lumberjack core library
NachoVazquez Apr 28, 2023
98fe461
chore: move agnostic configuration to core library
NachoVazquez Apr 29, 2023
3b38ec8
chore: move more agnostic features to core library
NachoVazquez Apr 29, 2023
d505369
chore: start moving the api test for the moved files
NachoVazquez Apr 29, 2023
5abfbe1
chore: move the api-test as needed
NachoVazquez Apr 29, 2023
4a11bc7
feat: make the core stable
NachoVazquez Apr 30, 2023
16e2b59
fix: all imports
NachoVazquez Apr 30, 2023
7437417
chore: add new library for final version
NachoVazquez Apr 30, 2023
873b0b3
feat: copy all files to the new library
NachoVazquez Apr 30, 2023
e615b5f
chore: remove old library
NachoVazquez Apr 30, 2023
57e6caf
chore: change all imports to the new library
NachoVazquez Apr 30, 2023
26dac76
chore: use swc to build the library
NachoVazquez May 1, 2023
8d5ebdc
Revert "chore: use swc to build the library"
NachoVazquez May 1, 2023
ff0431e
chore: noop
NachoVazquez May 1, 2023
0c24cb0
fix: more fix attempts
NachoVazquez May 1, 2023
68881f7
chore: migrate to latest nx
NachoVazquez May 1, 2023
f629208
chore: migrate core to swc
NachoVazquez May 1, 2023
dd22ac4
fix: solve import issues
NachoVazquez May 1, 2023
c2972c1
fix: errors are gone!!!
NachoVazquez May 1, 2023
c49fbe2
fix: remove unnecessary hacks
NachoVazquez May 1, 2023
d722b87
fix: fixable lint issues
NachoVazquez May 1, 2023
5ae4e28
Revert "chore: migrate core to swc"
NachoVazquez May 2, 2023
da63bb8
Revert "chore: migrate to latest nx"
NachoVazquez May 2, 2023
4e5e002
fix: remove unnecesary eslint ignore
NachoVazquez May 2, 2023
6a7e7b0
chore: convert to swc again
NachoVazquez May 2, 2023
e8be30f
fix: import issues on example app
NachoVazquez May 3, 2023
1e2e5ab
fix: build issues for the example app
NachoVazquez May 3, 2023
f9b4f50
fix: lint and tests
NachoVazquez May 3, 2023
2e5440d
fix: make build work again by selecting alternative build target name
NachoVazquez May 5, 2023
8461363
chore: migrate to latest nx (16.1)
NachoVazquez May 5, 2023
4eb49a7
fix: solve lint issues
NachoVazquez May 5, 2023
c4a6be9
feat: make spy driver agnostic using factory function
NachoVazquez May 6, 2023
840e60d
feat: extract lumberjack-log-driver-logger to agnostic api
NachoVazquez May 6, 2023
3fd2bee
feat: make console-dirver test-util library fall into angular namespace
NachoVazquez May 6, 2023
58953b4
feat: move the test-util library into a angular namespace
NachoVazquez May 6, 2023
ff80263
chore: add agnostic testing library
NachoVazquez May 10, 2023
d5cae60
chore: extract spy driver into core testing util library
NachoVazquez May 11, 2023
f3bbd9d
feat: replace lubmerjack service implementation with extracted core f…
NachoVazquez May 11, 2023
3889772
chore: extract lumberjack core to agnostic library
NachoVazquez May 17, 2023
2b6d117
fix: all failing tests
NachoVazquez May 17, 2023
34eb792
fix: rebase issues
NachoVazquez May 17, 2023
998aaae
fix: target dependecies for ngworker lumberjack
NachoVazquez May 17, 2023
441cbdf
chore: update nx
NachoVazquez May 17, 2023
0acf5c0
fix: format issues
NachoVazquez May 17, 2023
c910b49
chore: extract object driver to agnostic testing library
NachoVazquez May 19, 2023
c1c653b
chore: rename spy driver factory to match other file
NachoVazquez May 19, 2023
c0c14f0
chore: extract test drivers and fix createlumberjack tests
NachoVazquez May 21, 2023
2f80df3
chore: update to nx 16.2
NachoVazquez May 25, 2023
77eec67
feat: create raw quick lumberjack library
NachoVazquez May 27, 2023
b5c9c93
chore: adjust the eslint for multiple frameworks
NachoVazquez Jun 3, 2023
49e2e23
fix: eslint issues
NachoVazquez Jun 3, 2023
724697d
fix: rebase issues
NachoVazquez Jun 3, 2023
15f5e40
refactor: rename configFactory to createLumberjackConfig
NachoVazquez Jun 9, 2023
bf9ec14
refactor: rename factory functions to use the create*
NachoVazquez Jun 9, 2023
56e10d6
chore: wip before wipping qwik
NachoVazquez Jun 12, 2023
4564a77
chore: remove qwik references
NachoVazquez Jun 12, 2023
6506308
chore: fix rebase
NachoVazquez Jun 12, 2023
7315643
docs: update the tags section of the contributors to support technology
NachoVazquez Jun 13, 2023
50dc1d1
fix: rebase
NachoVazquez Jun 13, 2023
9487c68
feat: add support for solid and react on eslint technology tags
NachoVazquez Jun 13, 2023
159fc8f
fix: sonar issues
NachoVazquez Jun 13, 2023
3cdf524
test: create test for the createLumberjackConfig
NachoVazquez Jun 13, 2023
9d02c32
feat: add sonar report configurations for webworker-lumberjack
NachoVazquez Jun 13, 2023
bd7d33e
feat: stop exposing error handling logic on public api
NachoVazquez Jun 21, 2023
0245597
feat: remove the createLumberjackLogDriverLogger from the public api
NachoVazquez Jun 22, 2023
03a2f64
refactor: extract LumberjackLogFormatter into a separate file
NachoVazquez Jun 22, 2023
d043f9f
fix: move utcTimestampFor to the right group
NachoVazquez Jun 22, 2023
51b092b
docs: add missing js docs to methods and types
NachoVazquez Jun 22, 2023
02bb7b8
fix: lumberjack type export
NachoVazquez Jun 22, 2023
6791322
fix: imports
NachoVazquez Jun 22, 2023
df18667
refactor: remove the LumberjackLogFormatter and createLumberjackLogFo…
NachoVazquez Jun 22, 2023
99f4577
docs: add js docs for the createLumberjackLogFactory function
NachoVazquez Jun 22, 2023
0e7d279
fix: imports
NachoVazquez Jun 22, 2023
d60701a
fix: bring back the log factory service, this time as a wrapper of th…
NachoVazquez Jun 23, 2023
52cc398
feat: make getUnixEpochTicks optional
NachoVazquez Jun 24, 2023
fabcc5c
fix: log builder arguments order to adjust for default getUnixEpochTicks
NachoVazquez Jun 30, 2023
1829440
refactor: move libraries to the new common scope lumberjackjs
NachoVazquez Aug 7, 2023
1945759
refactor: move http-driver secondary entrypoint to a new package angu…
NachoVazquez Aug 8, 2023
dd6c53c
refactor: rename all files from lumberjack-http-driver to lumberjack-…
NachoVazquez Aug 8, 2023
726c906
feat: move console driver from angular to core
NachoVazquez Aug 9, 2023
c5e1451
fix: migration issues
NachoVazquez Aug 9, 2023
145df0e
feat: implement provideLumberjackCustomDrivers to allow the angular c…
NachoVazquez Aug 9, 2023
3a8e16d
refactor: rename all references from log driver to driver
NachoVazquez Aug 10, 2023
3d6e3a3
fix: adjust eslint and format
NachoVazquez Aug 10, 2023
7a0e6a5
fix: migration errors
NachoVazquez Aug 10, 2023
f45e413
refactor: remove implementation details from public api
NachoVazquez Aug 10, 2023
9e61a45
refactor: replace the concept of LubmerjackLogFactory with individual…
NachoVazquez Aug 10, 2023
a9252c9
refactor: stop using ReturnType<T> to create types for functions returns
NachoVazquez Aug 15, 2023
b665fda
refactor: make the log formatter return a function instead of an object
NachoVazquez Aug 15, 2023
a2a0d06
refactor: rename LumberjackService to LumberjackOrchestrator
NachoVazquez Aug 15, 2023
331567e
refactor: adjust grammar of comments/docs
NachoVazquez Aug 15, 2023
e683035
docs: add nest to the potential list of projects we will support
NachoVazquez Aug 15, 2023
44c5c82
docs: adjust community driver team and org name -- pr review suggestions
NachoVazquez Nov 5, 2023
c5a6e05
docs: make partial fixes to the drivers docs
NachoVazquez Nov 5, 2023
1bd120f
fix: createLumberjackLogFormatter failing tests
NachoVazquez Nov 11, 2023
d03bf56
fix: rename ngworker on paths
NachoVazquez Nov 11, 2023
d9720d9
feat: make the format function optional in the config and apply default
NachoVazquez Nov 12, 2023
7ebfd25
Revert "feat: make the format function optional in the config and app…
NachoVazquez Nov 12, 2023
91bf803
feat: allow getUnixEpochTicks to be optional
NachoVazquez Nov 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules

vite.config.ts
25 changes: 23 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"enforceBuildableLibDependency": true,
"allowCircularSelfDependency": true,
"allow": [],
"buildTargets": ["build", "build-package"],
"depConstraints": [
{
"sourceTag": "scope:public",
Expand All @@ -37,6 +38,26 @@
{
"sourceTag": "type:e2e",
"onlyDependOnLibsWithTags": ["type:app"]
},
{
"sourceTag": "technology:angular",
"onlyDependOnLibsWithTags": ["technology:angular", "technology:javascript"]
},
{
"sourceTag": "technology:qwik",
"onlyDependOnLibsWithTags": ["technology:qwik", "technology:javascript"]
},
{
"sourceTag": "technology:solid",
"onlyDependOnLibsWithTags": ["technology:solid", "technology:javascript"]
},
{
"sourceTag": "technology:react",
"onlyDependOnLibsWithTags": ["technology:react", "technology:javascript"]
},
{
"sourceTag": "technology:javascript",
"onlyDependOnLibsWithTags": ["technology:javascript"]
}
]
}
Expand Down Expand Up @@ -87,12 +108,12 @@
"group-ordering": [
{
"name": "project root",
"match": "^@(?!(ngworker|internal)).*|^[a-zA-Z].*",
"match": "^@(?!(lumberjackjs|internal)).*|^[a-zA-Z].*",
"order": 20
},
{
"name": "internal imports",
"match": "^@(ngworker|internal).*",
"match": "^@(lumberjackjs|internal).*",
"order": 30
},
{ "name": "parent directories", "match": "^\\.\\.", "order": 40 },
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ migrations.json
# Generated Docusaurus files
.docusaurus/
.cache-loader/

.angular
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
/reports
/.angular/
.docusaurus/
**/.lib.swcrc

# Generated files
packages/**/CHANGELOG.md

**/CHANGELOG.md
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ A project must have the following dimensions.

- Scope
- Type
- Technology

### Scope

Expand All @@ -151,3 +152,16 @@ The following are valid project types in this workspace.
| `e2e` | An end-to-end testing project. |
| `package` | A publishable library project released as an npm package. |
| `test-util` | A library project containing internal test utilities. |

### Technology

The following are valid project types in this workspace.

| Technology | Description |
| ------------ | ------------------------------------------------- |
| `javascript` | A project that is framework agnostic. |
| `angular` | A project that is based on the Angular framework. |
| `qwik` | A project that is based on the Qwik framework. |
| `solid` | A project that is based on the SolidJS framework. |
| `react` | A project that is based on the React framework. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Will we have a node tag (and Node.js SDK)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I wonder if we need it because the agnostic core should be enough. But a nestjs tag and NestJS SDK will be there.

| `nest` | A project that is based on the NestJS framework. |
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ Logo by Felipe Zambrano
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=ngworker_lumberjack&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=ngworker_lumberjack)

Lumberjack is a versatile Angular logging library, specifically designed to be extended and customized. It provides a
few simple [log drivers](https://en.wikipedia.org/wiki/Log_driving) (logging mechanisms, transports, log drivers)
out-of-the-box. It's easy to enable the built-in log drivers or create and use custom log drivers.
few simple [drivers](https://en.wikipedia.org/wiki/Log_driving) (logging mechanisms, transports, drivers)
out-of-the-box. It's easy to enable the built-in drivers or create and use custom drivers.

> For support, please refer to the `#lumberjack` channel in [the NgWorkers Discord server](https://discord.gg/UDUa8MA6Ef).

## Features

- ✅ Configurable multilevel logging
- ✅ Plugin-based log driver architecture
- ✅ Plugin-based driver architecture
- ✅ Robust error handling
- ✅ Console driver
- ✅ HTTP driver
Expand All @@ -45,13 +45,13 @@ out-of-the-box. It's easy to enable the built-in log drivers or create and use c

## Installation

Lumberjack is published as the `@ngworker/lumberjack` package.
Lumberjack is published as the `@lumberjackjs/angular` package.

| Toolchain | Command |
| --------- | ---------------------------------- |
| NPM CLI | `npm install @ngworker/lumberjack` |
| PNPM CLI | `pnpm add @ngworker/lumberjack` |
| Yarn CLI | `yarn add @ngworker/lumberjack` |
| Toolchain | Command |
| --------- | ----------------------------------- |
| NPM CLI | `npm install @lumberjackjs/angular` |
| PNPM CLI | `pnpm add @lumberjackjs/angular` |
| Yarn CLI | `yarn add @lumberjackjs/angular` |

## Documentation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { VERSION } from '@angular/core';

describe('Console log driver', () => {
describe('Console driver', () => {
function visit() {
cy.visit('/', {
onBeforeLoad(win): void {
Expand Down
2 changes: 1 addition & 1 deletion jest.preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const nxPreset = require('@nx/jest/preset').default;
/**
* We need to reset the mocks for each test to prevent the mocks being reused and affect the next test.
*
* For example in the lumberjack.service.spec.ts file some test were keeping the count of calls from previous usages of the spy.
* For example in the lumberjack-orchestrator.service.spec.ts file some test were keeping the count of calls from previous usages of the spy.
* */
module.exports = {
...nxPreset,
Expand Down
1 change: 0 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "ngworker",
"affected": {
"defaultBase": "main"
},
Expand Down
42 changes: 28 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"scripts": {
"postinstall": "node ./decorate-angular-cli.js",
"build": "nx run-many --target=build --all",
"ci": "yarn lint && yarn test && yarn build && yarn e2e",
"ci": "yarn format:check && yarn lint && yarn test && yarn build && yarn e2e",
"clean": "rimraf dist coverage reports",
"configure-sonar-report-paths": "node tools/scripts/configure-sonar-report-paths.mjs",
"delete-path-alias": "node tools/scripts/delete-path-alias.mjs",
"e2e": "nx run-many --target=e2e --all --parallel=1",
"format": "yarn nx format:write",
"format:check": "yarn nx format:check",
"lint": "nx run-many --target=lint --all --max-warnings=0",
"nx": "nx",
"start": "nx serve",
Expand All @@ -27,22 +28,22 @@
"yarn": "1.22.19"
},
"dependencies": {
"@angular/animations": "15.0.3",
"@angular/common": "15.0.3",
"@angular/compiler": "15.0.3",
"@angular/core": "15.0.3",
"@angular/forms": "15.0.3",
"@angular/platform-browser": "15.0.3",
"@angular/platform-browser-dynamic": "15.0.3",
"@angular/router": "15.0.3",
"@nx/angular": "16.3.2",
"@angular/animations": "15.2.8",
"@angular/common": "15.2.8",
"@angular/compiler": "15.2.8",
"@angular/core": "15.2.8",
"@angular/forms": "15.2.8",
"@angular/platform-browser": "15.2.8",
"@angular/platform-browser-dynamic": "15.2.8",
"@angular/router": "15.2.8",
"@docusaurus/core": "2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"prism-react-renderer": "^1.3.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@swc/helpers": "~0.5.0",
"rxjs": "7.8.1",
"tslib": "2.4.1",
"zone.js": "0.12.0"
Expand All @@ -61,20 +62,27 @@
"@commitlint/config-conventional": "17.3.0",
"@docusaurus/module-type-aliases": "2.4.1",
"@jscutlery/semver": "3.0.0",
"@nx/angular": "16.3.2",
"@nx/cypress": "16.3.2",
"@nx/devkit": "16.3.2",
"@nx/eslint-plugin": "16.3.2",
"@nx/jest": "16.3.2",
"@nx/linter": "16.3.2",
"@nx/workspace": "16.3.2",
"@nx-plus/docusaurus": "^15.0.0-rc.0",
"@schematics/angular": "15.0.3",
"@tsconfig/docusaurus": "^1.0.6",
"@nx/js": "16.3.2",
"@nx/vite": "16.3.2",
"@schematics/angular": "15.2.7",
"@swc/cli": "~0.1.55",
"@swc/core": "^1.2.173",
"@swc/helpers": "~0.4.11",
"@types/copy": "0.3.2",
"@types/jest": "29.4.4",
"@types/node": "18.11.13",
"@types/node": "^18.16.1",
"@typescript-eslint/eslint-plugin": "5.59.2",
"@typescript-eslint/parser": "5.59.2",
"@vitest/ui": "^0.31.0",
"copy": "0.3.2",
"cypress": "^12.2.0",
"eslint": "8.15.0",
Expand All @@ -89,7 +97,7 @@
"jest": "29.4.3",
"jest-environment-jsdom": "29.4.3",
"jest-preset-angular": "13.1.1",
"ng-packagr": "15.0.3",
"ng-packagr": "15.2.2",
"ngx-deploy-npm": "6.0.0",
"nx": "16.3.2",
"nx-cloud": "16.0.5",
Expand All @@ -102,6 +110,12 @@
"rimraf": "3.0.2",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "4.8.4"
"typescript": "~4.8.2",
"undici": "^5.22.0",
"vite": "^4.3.8",
"vite-plugin-dts": "~1.7.1",
"vite-plugin-eslint": "^1.8.1",
"vite-tsconfig-paths": "~4.2.0",
"vitest": "^0.31.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description: Lumberjack v15 is here, and we are happy to share everything that's
slug: announcing-lumberjack-v15
authors:
- name: Nacho Vazquez
title: NgWorker and core maintainer of Lumberjack
title: Core maintainer of Lumberjack
url: https://github.com/NachoVazquez
image_url: https://github.com/NachoVazquez.png
- name: Lars Gyrup Brink Nielsen
title: NgWorker and core maintainer of Lumberjack
title: Core maintainer of Lumberjack
url: https://github.com/LayZeeDK
image_url: https://github.com/LayZeeDK.png
tags: [announcement, lumberjack, v15]
Expand Down Expand Up @@ -58,7 +58,7 @@ bootstrapApplication(AppComponent, {
// (…)
provideLumberjack(),
provideLumberjackConsoleDriver(),
provideLumberjackHttpDriver(withHttpConfig({…})),
provideLumberjackAngularHttpDriver(withHttpConfig({…})),
// (…)
],
});
Expand Down Expand Up @@ -89,7 +89,7 @@ We can use the `withHttpOptions.`
bootstrapApplication(AppComponent, {
providers: [
provideLumberjack(),
provideLumberjackHttpDriver(
provideLumberjackAngularHttpDriver(
withHttpOptions({
origin: 'ForestApp',
retryOptions: { maxRetries: 1, delayMs: 250 },
Expand All @@ -104,7 +104,7 @@ Or the `withHttpConfig`
bootstrapApplication(AppComponent, {
providers: [
provideLumberjack(),
provideLumberjackHttpDriver(
provideLumberjackAngularHttpDriver(
withHttpConfig({
levels: [LumberjackLevel.Error],
origin: 'ForestApp',
Expand All @@ -114,13 +114,13 @@ bootstrapApplication(AppComponent, {
),
```

The big novelty is that now, we can also configure the underlying `HttpClient` using the second argument of the `provideLumberjackHttpDriver` function.
The big novelty is that now, we can also configure the underlying `HttpClient` using the second argument of the `provideLumberjackAngularHttpDriver` function.

```ts
bootstrapApplication(AppComponent, {
providers: [
provideLumberjack(),
provideLumberjackHttpDriver(
provideLumberjackAngularHttpDriver(
withHttpConfig({
levels: [LumberjackLevel.Error],
origin: 'ForestApp',
Expand Down
Loading
Loading