Skip to content

Commit

Permalink
Documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOHart committed Jan 22, 2025
1 parent 0ef46fe commit 7232018
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions apps/design/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

GO 1.21 introduces enhanced features like structured logging with `log/slog`.
As part of MSAL GO, we have decided to only support logging using slog from version 1.21.
The reason for this is `log/slog` greatly enhances the debugging and monitoring capabilities compared to the old SDK. This is especially useful in production environments where accurate, traceable logs are crucial for maintaining application health and troubleshooting issues. For versions older than 1.21, the user can specify *nil* to the *New()* function and a no-op is returned
The reason for this is `log/slog` greatly enhances the debugging and monitoring capabilities compared to the old SDK. This is especially useful in production environments where accurate, traceable logs are crucial for maintaining application health and troubleshooting issues.

## **Expected Output**

Expand All @@ -15,12 +15,8 @@ time=2024-12-19T01:25:58.730Z level=INFO msg="Default log message." module=main

## Key Pointers

1. **For Go <= 1.20**:
- User should pass *nil* to `logger.New(nil)`
- No-op is returned and can be handled by user

2. **Full `slog` Support for Go 1.21+**:
1. **Full `slog` Support for Go 1.21+**:
- The `logger.go` file leverages the `slog` package, supporting structured logs, multiple log levels (`info`, `error`, `warn`), and fields.

3. **Structured Logging**:
2. **Structured Logging**:
- You can pass key-value pairs using `slog.String`, `slog.Int`, etc., for structured logging, which is handled by `slog` in Go 1.21 and later.

0 comments on commit 7232018

Please sign in to comment.