docs: added documentation to TILogging

This commit is contained in:
Nikita Semenov 2022-12-29 17:33:08 +03:00
parent 71306b695b
commit 57d40f18ef
2 changed files with 29 additions and 0 deletions

View File

@ -1,5 +1,10 @@
# Changelog
### 1.30.1
- **Fix**: `TILogging` bug with passing arguments to a logging message with wrapped `os_log` function;
- **Added**: Documentation for `TILogging`.
### 1.30.0
- **Added**: Base classes for encryption and decryption user token with pin code or biometry

24
TILogging/README.md Normal file
View File

@ -0,0 +1,24 @@
# TILogging
## Logger usage
```swift
let logger = TILogger.defaultLogger
// string interpolation
logger.log(type: .default, "🐈 Hello from \(someName), I'm machine number \(someNumer)")
// passing CVarArgs
logger.log("🐈 Hello from %@, I'm machine number %i", type: .default, someName, someNumber)
```
To pass arguments to a logging string it is essantial to pass valid formatting specifiers
| Specifier | Type | Usage |
| --------- | ---- | ----- |
| `%i`, `%d` | `Int` | `logger.verbose("🎉 int %i", 1)` |
| `%f` | `Float` | `logger.verbose("🎉 float %f", Float(1.23))` |
| `%f` | `Double` | `logger.verbose("🎉 double %f", Double(1.23))` |
| `%@` | `String` | `logger.verbose("🎉 string %@", "String")` |
> For more information about string format specifiers check the [documentation](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html)