Structure
IfMaxLevelFragment
Make the current fragment conditional, only calling its
output method if the record’s loggerLevel is maxLevel or lowerstruct IfMaxLevelFragment<T> where T : LoggerFragment
Mentioned in
Overview
The sequence
Literal("IsDebugOrTrace").maxLevel(.debug)
will only include “IsDebugOrTrace” in the output when the log level is debug or lower.
This fragment is considered to not have content if the logging level is higher than than maxLevel.
Topics
Initializers
Instance Properties
Instance Methods
func hasContent(record: inout LogRecord) -> BoolIndicates whether the fragment will write anything tooutputwhenwrite(_:to:)is called.func write(inout LogRecord, to: inout FragmentOutput)Add this fragment’s output to the console text.
Relationships
Conforms To
LoggerFragmentSwift.SendableSwift.SendableMetatype
See Also
Logger Fragments
protocol LoggerFragmentA fragment of a log message.enum LoggerFragmentBuilderA result builder for creating logger fragments in a declarative way.struct FragmentOutputThe output of aLoggerFragment, including some intermediary state used for things like deduplicating separators.struct AndFragmentCombine the current fragment with another, which will be written after the current fragment finishes.struct OptionalFragmentA fragment that conditionally includes another fragment.struct ArrayFragmentA fragment that combines multiple fragments of the same type.struct LabelFragmentWrites the label of the logger, and requests a separator for the next fragment.struct LevelFragmentWrites the level of the logged message, and requests a separator for the next fragment.struct LiteralFragmentWrites the given text to the output.struct SeparatorFragmentstruct SpacedFragmentA fragment that wraps another fragment, automatically separating its components with spaces.struct MessageFragmentWrites the logged message to the output, and requests a separator for the next fragment.struct MetadataFragmentWrites the combined metadata to the output, and requests a separator for the next fragment only if the metadata was not empty.struct SourceLocationFragmentWrites the file location of the logged message, including the line.struct LoggerSourceFragmentWrites the source of the logged message.