Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamwulf/logfmt
https://github.com/adamwulf/logfmt
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/adamwulf/logfmt
- Owner: adamwulf
- License: mit
- Created: 2024-06-29T05:49:25.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-29T20:33:52.000Z (5 months ago)
- Last Synced: 2024-06-30T21:31:42.731Z (5 months ago)
- Language: Swift
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Logfmt
Logfmt provides a `logfmt(object)` method on `String` instances to easily format any input object into [logfmt](https://www.brandur.org/logfmt).
Example:
``` swift
let memoryContext = ["memory":
["current": ["footprint": 128,
"available": 2000 - 128,
"limit": 2000],
"peak": ["footprint": 348,
"available": 2000 - 348,
"limit": 2000]]]
let formatted = String.logfmt(memoryContext)
print(formatted)
```will output:
```
memory.current.available=1872 memory.current.footprint=128 memory.current.limit=2000 memory.peak.available=1652 memory.peak.footprint=348 memory.peak.limit=2000
```The `Logfmt` class is in progress will eventually help integrate apple's [Logging](https://github.com/apple/swift-log) framework.