Reportage 1.0

Reportage 1.0

Maintained by Igor Matyushkin.




Reportage

At a Glance

Reportage is a powerful tool that simplifies console output in Xcode.

How To Get Started

  • Copy content of Source folder to your project.

or

  • Use Reportage cocoapod

Requirements

  • iOS 9 and later
  • Xcode 9 and later
  • Swift 4

Usage

Settings

Everything starts with Logger instance. Usually, it's enough to use the singletone (Logger.shared), but you can create another one with Logger().

Logger is a highly customizable thing. You can setup width of line, offset, prefix and many other things.

Setting Possible values Default value Description
width Any Int value bigger than 0. 40 Maximum width of line. Measured in symbols.
offset Any Int value equal to or bigger than 0. 0 Left offset of logger's output. Measured in symbols.
offsetPattern Any String value. Space. Pattern to fill the offset's space with.
dateFormat .date
.time
.dateTime
.custom(value: String)
.none
.dateTime Format of date printed before the message. If .none, date will not be printed.
prefix Any String value. Empty. Prefix of the message. Usually emoji but can be anything else.
uppercased true
false
false Specifies whether message should be uppercased or not.
header .emptyLine
.line(pattern: String)
.custom(text: String)
.none
.none Header that is printed before the message.
footer .emptyLine
.line(pattern: String)
.custom(text: String)
.none
.emptyLine Footer that is printed after the message.

Example of Logger's full customization:

Logger.shared
    .width(80)
    .offset(4)
    .offsetPattern(" ")
    .prefix("🚀")
    .dateFormat(.dateTime)
    .uppercased(false)
    .header(.none)
    .footer(.emptyLine)

Output

Sending message to console is incredibly easy:

logger.print("Some message")

Also, you can change output settings on the go:

logger
    .dateFormat(.none)
    .offset(0)
    .prefix("🚀")
    .print("App is launched")
    .dateFormat(.time)
    .offset(20)
    .prefix("🖥")
    .print("Authorization requested")

License

Reportage is available under the Apache 2.0 license. See the LICENSE file for more info.