Skip to content

a hardcoded timestamp does not contain milli- or nanoseconds in any format #212

Description

@vitalz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions