a hardcoded timestamp does not contain milli- or nanoseconds in any format
- Dominant language
- Swift
- Stars
- 4k
- Forks
- 344
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 5
Description
### Expected behavior
Timestamp should have nanoseconds by default or it should be possible to customise timestamp.
### Actual behavior
There are only seconds on a time value. For example there is a log line:
```
2021-11-06T18:47:14+0300 info
```
### Steps to reproduce
1. Just use `StreamLogHandler.standardOutput` at `LoggingSystem.bootstrap`
### There is minimal reproducer code
```
LoggingSystem.bootstrap{ label in
var logHandler = StreamLogHandler.standardOutput(label: " org.example.myproject." + label)
logHandler.logLevel = Logger.Level.debug
return logHandler
}
```
### SwiftLog version (tag)
_1.4.2_
This issue also affects all versions before it.
### Swift & OS version
Swift:
```
vital@Vitals-MacBook-Air ~ % swift --version && uname -a
swift-driver version: 1.26.9 Apple Swift version 5.5.1 (swiftlang-1300.0.31.4 clang-1300.0.29.6)
Target: arm64-apple-macosx11.0
Darwin Vitals-MacBook-Air.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:38 PDT 2021; root:xnu-7195.141.8~1/RELEASE_ARM64_T8101 arm64
vital@Vitals-MacBook-Air ~ %
```
Docker container (Linux Ubuntu)
```
root@1765fec3b27c:/usr/src# swift --version && uname -a
Swift version 5.3 (swift-5.3-RELEASE)
Target: x86_64-unknown-linux-gnu
Linux 1765fec3b27c 5.10.47-linuxkit #1 SMP PREEMPT Sat Jul 3 21:50:16 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
root@1765fec3b27c:/usr/src
```
### Code line contains a bug
There is a place where timestamp is hardcoded:
[source](https://github.com/apple/swift-log/blob/1.4.2/Sources/Logging/Logging.swift#L933)
Contributor guide
Research direction
Start at Sources/Logging/Logging.swift around line 933, where the timestamp format is hardcoded, and reproduce the behavior with StreamLogHandler.standardOutput during LoggingSystem.bootstrap. Confirm how timestamp formatting is currently selected and make the reported timestamp precision or customization requirement demonstrably satisfied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100