Skip to content

Improved Swift 6 handling #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "Swift",
"image": "swift:5.9.1",
"image": "swift:6.0",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "false",
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"userUid": "1001",
"userGid": "1001",
"upgradePackages": "false"
},
"ghcr.io/devcontainers/features/git:1": {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit Test
name: Test Swift 5.9

on:
push:
@@ -8,11 +8,11 @@ on:

jobs:
build:

container: swift:5.9
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: swift build -v
run: swift build
- name: Run tests
run: swift test -v
run: swift test
18 changes: 18 additions & 0 deletions .github/workflows/swift-6.0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Test Swift 6.0

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
container: swift:6.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: swift build
- name: Run tests
run: swift test
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -25,7 +25,8 @@ let package = Package(
.testTarget(
name: "DataDogLogTests",
dependencies: ["DataDogLog"]),
]
],
swiftLanguageVersions: [.version("6"), .v5]
)

#if os(Linux)
Original file line number Diff line number Diff line change
@@ -4,8 +4,11 @@ extension String {
static var timestamp: String {
var buffer = [Int8](repeating: 0, count: 255)
var timestamp = time(nil)
let localTime = localtime(&timestamp)
guard let localTime = localtime(&timestamp) else {
return "<unknown>"
}
strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime)

return buffer.withUnsafeBufferPointer {
$0.withMemoryRebound(to: CChar.self) {
String(cString: $0.baseAddress!)
2 changes: 1 addition & 1 deletion Sources/DataDogLog/Internal/NetworkClient.swift
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ final class NetworkClient: Sendable {

deinit {
#if os(Linux)
client.shutdown()
client.shutdown { _ in }
#endif
}