Skip to content

Commit ff976f5

Browse files
committed
fixup! move traits docs to the docs
1 parent 4c689f3 commit ff976f5

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Sources/Logging/Docs.docc/DisableLogLevelsDuringCompilation.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
### Disable log levels during compilation
1+
# Disable log levels during compilation
22

33
SwiftLog provides compile-time traits to eliminate less severe log levels from
44
your binary reducing the runtime overhead.
55

6-
#### Motivation
6+
## Motivation
77

88
When deploying applications to production, you often know in advance which log
99
levels will never be needed. For example, a production service might only need
1010
warning and above, while trace and debug levels are only useful during
1111
development. By using traits, you can completely remove these unnecessary log
1212
levels at compile time, achieving zero runtime overhead.
1313

14-
#### Available traits
14+
## Available traits
1515

1616
SwiftLog defines seven maximum log level traits, ordered from most permissive
1717
to most restrictive:
@@ -33,12 +33,13 @@ By default (when no traits are specified), all log levels are available.
3333
When you specify a maximum log level trait, all less severe levels are
3434
completely removed from your binary at compile time. This applies to both
3535
level-specific methods (e.g., `logger.debug()`) and calls to the generic
36-
`logger.log(level:)` method.
36+
`logger.log(level:)` method. Traits are additive. If multiple max level traits
37+
are specified, the most restrictive one takes effect.
3738

38-
> Note: Traits are additive. If multiple max level traits are specified, the
39-
> most restrictive one takes effect.
39+
> Note: Traits should only be set by the applications and not libraries as
40+
> any traits defined in a transitive dependency will affect the whole resolution tree.
4041
41-
#### Example
42+
## Example
4243

4344
To enable a trait, specify it when declaring your package dependency:
4445

Sources/Logging/Docs.docc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ backend.
9292

9393
- <doc:LoggingBestPractices>
9494
- <doc:ImplementingALogHandler>
95+
- <doc:DisableLogLevelsDuringCompilation>
9596

9697
### Contributing
9798

0 commit comments

Comments
 (0)