Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 14b8467

Browse files
committed
Set up logging system for swift-doc
1 parent a508e29 commit 14b8467

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Sources/swift-doc/main.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import ArgumentParser
22
import Foundation
3+
import Logging
4+
import LoggingGitHubActions
5+
6+
LoggingSystem.bootstrap { label in
7+
if ProcessInfo.processInfo.environment["GITHUB_ACTIONS"] == "true" {
8+
return GitHubActionsLogHandler.standardOutput(label: label)
9+
} else {
10+
return StreamLogHandler.standardOutput(label: label)
11+
}
12+
}
13+
14+
let logger = Logger(label: "org.swiftdoc.swift-doc")
315

416
let fileManager = FileManager.default
517
let fileAttributes: [FileAttributeKey : Any] = [.posixPermissions: 0o744]
@@ -10,8 +22,7 @@ var standardError = FileHandle.standardError
1022
struct SwiftDoc: ParsableCommand {
1123
static var configuration = CommandConfiguration(
1224
abstract: "A utility for generating documentation for Swift code.",
13-
subcommands: [Generate.self, Coverage.self, Diagram.self],
14-
defaultSubcommand: Generate.self
25+
subcommands: [Generate.self, Coverage.self, Diagram.self]
1526
)
1627
}
1728

0 commit comments

Comments
 (0)