XcodeColorsTextColorizer

public struct XcodeColorsTextColorizer: TextColorizer

A TextColorizer implementation that applies XcodeColors-compatible formatting to log messages.

  • Initializes a new instance if and only if XcodeColors is installed and enabled, as indicated by the presence of the XcodeColors environment variable. (Unless the value of this variable is the string YES, this initializer will fail.)

    Declaration

    Swift

    public init?()
  • Applies XcodeColors-style formatting appropriate for the given LogSeverity to the passed-in string.

    Declaration

    Swift

    public func colorize(_ str: String, foreground: Color?, background: Color?)
            -> String

    Parameters

    string

    The string to be colorized.

    foreground

    An optional foreground color to apply to string.

    background

    An optional background color to apply to string.

    Return Value

    A version of string with the appropriate color formatting applied.