https://github.com/simplisticated/reportage
Console logger for iOS
https://github.com/simplisticated/reportage
debugger ios logger swift xcode
Last synced: 3 months ago
JSON representation
Console logger for iOS
- Host: GitHub
- URL: https://github.com/simplisticated/reportage
- Owner: simplisticated
- License: apache-2.0
- Created: 2018-08-17T10:05:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-31T21:07:13.000Z (over 7 years ago)
- Last Synced: 2024-04-23T17:25:11.353Z (almost 2 years ago)
- Topics: debugger, ios, logger, swift, xcode
- Language: Swift
- Homepage:
- Size: 73.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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:
```swift
Logger.shared
.width(80)
.offset(4)
.offsetPattern(" ")
.prefix("🚀")
.dateFormat(.dateTime)
.uppercased(false)
.header(.none)
.footer(.emptyLine)
```
### Output
Sending message to console is incredibly easy:
```swift
logger.print("Some message")
```
Also, you can change output settings on the go:
```swift
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](./LICENSE) file for more info.