Skip to content

Commit

Permalink
Readme, comments
Browse files Browse the repository at this point in the history
  • Loading branch information
david-littlefarmer committed Oct 27, 2023
1 parent e7cd7a2 commit 6bf9b71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ slog.SetDefault(logger)
opts := &devslog.Options{
MaxSlicePrintSize: 4,
SortKeys: true,
TimeFormat: "[04:05]"
TimeFormat: "[04:05]",
DebugColor: devslog.Magenta,
}

logger := slog.New(devslog.NewHandler(os.Stdout, opts))
Expand Down Expand Up @@ -91,8 +92,12 @@ slog.SetDefault(logger)
```

## Options
| Parameter | Description | Default | Value |
|-------------------|----------------------------------------------------------------|--------------|--------|
| MaxSlicePrintSize | Specifies the maximum number of elements to print for a slice. | 50 | uint |
| SortKeys | Determines if attributes should be sorted by keys. | false | bool |
| TimeFormat | Time format for timestamp. | "[15:04:05]" | string |
| Parameter | Description | Default | Value |
|-------------------|----------------------------------------------------------------|----------------|----------------------|
| MaxSlicePrintSize | Specifies the maximum number of elements to print for a slice. | 50 | uint |
| SortKeys | Determines if attributes should be sorted by keys. | false | bool |
| TimeFormat | Time format for timestamp. | "[15:04:05]" | string |
| DebugColor | Color for Debug level | devslog.Blue | devslog.Color (uint) |
| InfoColor | Color for Info level | devslog.Green | devslog.Color (uint) |
| WarnColor | Color for Warn level | devslog.Yellow | devslog.Color (uint) |
| ErrorColor | Color for Error level | devslog.Red | devslog.Color (uint) |
11 changes: 9 additions & 2 deletions devslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@ type Options struct {
// Time format for timestamp, default format is "[15:04:05]"
TimeFormat string

// Set color for Debug level, default: devslog.Blue
DebugColor Color
InfoColor Color
WarnColor Color

// Set color for Info level, default: devslog.Green
InfoColor Color

// Set color for Warn level, default: devslog.Yellow
WarnColor Color

// Set color for Error level, default: devslog.Red
ErrorColor Color
}

Expand Down

0 comments on commit 6bf9b71

Please sign in to comment.