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

docs: release lumberjack 15 #1

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# blog
All ngworker related blog posts. This allows ngworker members to review blog posts before publishing.
# NgWorker Blog Posts

## Lumberjack

- [Introducing @ngwoker/lumberjack@v15](./lumberjack/introducing-lumberjack-15.md)
126 changes: 126 additions & 0 deletions lumberjack/introducing-lumberjack-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Announcing @ngworker/lumberjack version 15: A Step Forward

We are pleased to share that we've just released @ngworker/lumberjack version 15. The team have been quietly working on a few updates that we hope you will find useful. Enough small talk, let's dive into what's new!

**TL;DR** - Lumberjack version 15 introduces a few updates worth noting: internal upgrades like the use of the latest type-safe `inject` function for all possible dependencies, updates to Angular version 15, Nx version 16.1, and Node 18. The big announcement is that we've added support for standalone Angular applications. Now, you can conveniently include Lumberjack in the `bootstrapApplication` function and configure Lumberjack drivers as needed.

## Better Type Safety

First on our list, we've introduced the use of the newest type-safe `inject` function moving away from constructor paramter decorators. This is just a small step towards improving the type safety (it is quite good) of our source code and aligning our Angular implementations with recent standards.

## Keeping Current

We are all excited about everything that's happening on the JavaScript world. That's why we will continue putting efforts on keeping Lumberjack up to date with the latest version of Angular and any other tool that's part of the Lumberjack suite. This time, we have updated to Angular version 15, Nx version 16.1, and Node 18. Please note, this will introduce breaking changes; make sure to update to Angular 15 before upgrading Lumberjack.

## Supporting Standalone Angular Applications

And the cherry of the cake is...

Our most exciting announcement is that we've added support standalone Angular applications. Now, you can include Lumberjack directly in the `bootstrapApplication` function. Here's a simple example of how to use the new APIs:

```ts
bootstrapApplication(AppComponent, {
providers: [
// (...)
provideLumberjack(),
// (...)
],
});
```

### Enhanced Driver Configuration

We've also made it possible for you to enable the standalone providers for the out-of-the-box Lumberjack drivers. Here's how you can do it:

```ts
bootstrapApplication(AppComponent, {
providers: [
// (...)
provideLumberjack(),
provideLumberjackConsoleDriver(),
provideLumberjackHttpDriver(withHttpConfig({...})),
// (...)
],
});
```

### Advanced Configuration for Those Who Want More

Configuring `Lumberjack` and the `ConsoleDriver` with the new API should represent a similar experience that what we have been able to do before with Modules.

Both `Lumberjack` and the `ConsoleDriver` can be configure without any extra arguments or by passing a configuration object as the single parameter of the provide functions.

```ts
bootstrapApplication(AppComponent, {
providers: [
provideLumberjack({ levels: [LumberjackLevel.Error] }),
provideLumberjackConsoleDriver({
levels: [LumberjackLevel.Info, LumberjackLevel.Error],
}),
],
});
```

The `HttpDriver` is slightly more advanced since now we need to use the `with*` config functions for the diffent configurations types.

We can use the `withHttpOptions`

```ts
bootstrapApplication(AppComponent, {
providers: [
provideLumberjack(),
provideLumberjackHttpDriver(
withHttpOptions({
origin: 'ForestApp',
retryOptions: { maxRetries: 1, delayMs: 250 },
storeUrl: '/api/logs',
}),
),
```

Or the `withHttpConfig`

```ts
bootstrapApplication(AppComponent, {
providers: [
provideLumberjack(),
provideLumberjackHttpDriver(
withHttpConfig({
levels: [LumberjackLevel.Error],
origin: 'ForestApp',
retryOptions: { maxRetries: 1, delayMs: 250 },
storeUrl: '/api/logs',
}),
),
```

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

```ts
bootstrapApplication(AppComponent, {
providers: [
provideLumberjack(),
provideLumberjackHttpDriver(
withHttpConfig({
levels: [LumberjackLevel.Error],
origin: 'ForestApp',
retryOptions: { maxRetries: 1, delayMs: 250 },
storeUrl: '/api/logs',
}),
withInterceptors([
(req, next) => {
const easy = inject(easyToken);
console.log('are interceptors working?', easy);
return next(req);
},
])
),
```

## Continuous Module Support

We want to assure you that we continue to support modules. The new standalone APIs are a complement, not a replacement. Choose your poison.

## Wrapping Up

We hope these changes will be of help in your Angular application development journey. We're grateful for your support, and as always, happy coding!