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 2 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)
124 changes: 124 additions & 0 deletions lumberjack/introducing-lumberjack-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# 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 for injecting all possible dependencies. This is just a small step towards improving the type safety of our source code and aligning our Angular implementations with recent standards.
LayZeeDK marked this conversation as resolved.
Show resolved Hide resolved

## Keeping Current

We believe it's important to stay up-to-date. With that in mind, we've updated to Angular version 15, Nx version 16.1, and Node 18. Please note, this will introduce some breaking changes, but we trust you'll navigate them like the pros you are!
LayZeeDK marked this conversation as resolved.
Show resolved Hide resolved

## Supporting Standalone Angular Applications

A significant change in this version is the added support for standalone Angular applications. Now, you can include Lumberjack directly in the `bootstrapApplication` function. Here's a simple example:

```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 be a familiar compared to how we configure the modules.

It is as simple as passing the 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 `withHttpOptions`

```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.

## 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!