1- ### Disable log levels during compilation
1+ # Disable log levels during compilation
22
33SwiftLog provides compile-time traits to eliminate less severe log levels from
44your binary reducing the runtime overhead.
55
6- #### Motivation
6+ ## Motivation
77
88When deploying applications to production, you often know in advance which log
99levels will never be needed. For example, a production service might only need
1010warning and above, while trace and debug levels are only useful during
1111development. By using traits, you can completely remove these unnecessary log
1212levels at compile time, achieving zero runtime overhead.
1313
14- #### Available traits
14+ ## Available traits
1515
1616SwiftLog defines seven maximum log level traits, ordered from most permissive
1717to most restrictive:
@@ -33,12 +33,13 @@ By default (when no traits are specified), all log levels are available.
3333When you specify a maximum log level trait, all less severe levels are
3434completely removed from your binary at compile time. This applies to both
3535level-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
4344To enable a trait, specify it when declaring your package dependency:
4445
0 commit comments