Skip to content
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

Support for Apple Silicon #106

Open
wants to merge 9 commits into
base: swift-5
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: objective-c
xcode_project: CleanroomLogger.xcodeproj
os: osx
osx_image: xcode9.3
osx_image: xcode10.3

branches:
only:
Expand All @@ -16,7 +16,7 @@ before_install:
- travis_wait 30 git submodule update --init

install:
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-document --quiet
- rm -rf ~/Library/Developer/CoreSimulator # these two lines are a hack around a recurring Travis problem: multiple versions of the
- sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService # same simulator: https://github.com/travis-ci/travis-ci/issues/7580#issuecomment-292974395

Expand Down
16 changes: 15 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
// swift-tools-version:5.0

import PackageDescription

let package = Package(
name: "CleanroomLogger"
name: "CleanroomLogger",
products: [
.library(
name: "CleanroomLogger",
targets: ["CleanroomLogger"]),
],
targets: [
.target(
name: "CleanroomLogger",
dependencies: [],
path: "Sources"),
]
)

10 changes: 5 additions & 5 deletions Sources/BasicLogConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@
open class BasicLogConfiguration: LogConfiguration
{
/** The minimum `LogSeverity` supported by the configuration. */
open let minimumSeverity: LogSeverity
public let minimumSeverity: LogSeverity

/** The `LogFilter`s to use when deciding whether a given `LogEntry` should
be passed along to the receiver's `recorders`. If any filter returns
`false` from `shouldRecordLogEntry(_:)`, the `LogEntry` will be silently
ignored when being processed for this `LogConfiguration`. */
open let filters: [LogFilter]
public let filters: [LogFilter]

/** The `LogRecorder`s to use for recording any `LogEntry` that has passed
the filtering process. */
open let recorders: [LogRecorder]
public let recorders: [LogRecorder]

/** A flag indicating whether synchronous mode will be used when passing
`LogEntry` instances to the receiver's `recorders`. Synchronous mode is
helpful while debugging, as it ensures that logs are always up-to-date
when debug breakpoints are hit. However, synchronous mode can have a
negative influence on performance and is therefore not recommended for use
in production code. */
open let synchronousMode: Bool
public let synchronousMode: Bool

/** For organizational purposes, a given `LogConfiguration` may in turn
contain one or more additional `LogConfiguration`s. Each contained
`LogConfiguration` is an entirely separate entity; children do not inherit
any state from parent containers. */
open let configurations: [LogConfiguration]?
public let configurations: [LogConfiguration]?

/**
Initializes a new `BasicLogConfiguration` instance.
Expand Down
4 changes: 2 additions & 2 deletions Sources/BufferedLogRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ open class BufferedLogRecorder<BufferItem>: LogRecorderBase
{
/** The maximum number if items that will be stored in the receiver's
buffer */
open let bufferLimit: Int
public let bufferLimit: Int

/** The function used to create a `BufferItem` given a `LogEntry` and a
formatted message string. */
open let createBufferItem: (LogEntry, String) -> BufferItem
public let createBufferItem: (LogEntry, String) -> BufferItem

/** The buffer, an array of `BufferItem`s created to represent the
`LogEntry` values recorded by the receiver. */
Expand Down
4 changes: 2 additions & 2 deletions Sources/ConcatenatingLogFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
open class ConcatenatingLogFormatter: LogFormatter
{
/** The `LogFormatter`s whose output will be concatenated. */
open let formatters: [LogFormatter]
public let formatters: [LogFormatter]

/** Determines the behavior of `format(_:)` when one of the receiver's
`formatters` returns `nil`. When `false`, if any formatter returns
Expand All @@ -22,7 +22,7 @@ open class ConcatenatingLogFormatter: LogFormatter
receiver will always return a non-`nil` value. However, when `hardFail`
is `true`, _all_ of the `formatters` must return strings; if _any_
formatter returns `nil`, the receiver _also_ returns `nil`. */
open let hardFail: Bool
public let hardFail: Bool

/**
Initializes a new `ConcatenatingLogFormatter` instance.
Expand Down
2 changes: 1 addition & 1 deletion Sources/DelimiterLogFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public extension DelimiterStyle
/**
Returns the field delimiter string indicated by the receiver's value.
*/
public var delimiter: String {
var delimiter: String {
switch self {
case .spacedPipe: return " | "
case .spacedHyphen: return " - "
Expand Down
2 changes: 1 addition & 1 deletion Sources/FileLogRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Dispatch
open class FileLogRecorder: LogRecorderBase
{
/** The path of the file to which log entries will be written. */
open let filePath: String
public let filePath: String

private let file: UnsafeMutablePointer<FILE>?
private let newlines: [Character] = ["\n", "\r"]
Expand Down
5 changes: 4 additions & 1 deletion Sources/LogReceptacle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ public final class LogReceptacle
{
let synchronous = config.synchronousMode
let acceptDispatcher = dispatcherForQueue(acceptQueue, synchronous: synchronous)
acceptDispatcher {
acceptDispatcher { [weak self] in
guard let self = self else {
return
}
if self.doesLogEntry(entry, passFilters: config.filters) {
for recorder in config.recorders {
let recordDispatcher = self.dispatcherForQueue(recorder.queue, synchronous: synchronous)
Expand Down
4 changes: 2 additions & 2 deletions Sources/LogRecorderBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ open class LogRecorderBase: LogRecorder
{
/** The `LogFormatter`s that will be used to format messages for the
`LogEntry`s to be logged. */
open let formatters: [LogFormatter]
public let formatters: [LogFormatter]

/** The GCD queue that should be used for logging actions related to the
receiver. */
open let queue: DispatchQueue
public let queue: DispatchQueue

/**
Initialize a new `LogRecorderBase` instance.
Expand Down
4 changes: 2 additions & 2 deletions Sources/RotatingLogFileRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ open class RotatingLogFileRecorder: LogRecorderBase
{
/** The number of days for which the receiver will retain log files
before they're eligible for pruning. */
open let daysToKeep: Int
public let daysToKeep: Int

/** The filesystem path to a directory where the log files will be
stored. */
open let directoryPath: String
public let directoryPath: String

private static let filenameFormatter: DateFormatter = {
let fmt = DateFormatter()
Expand Down
2 changes: 1 addition & 1 deletion Sources/XcodeLogFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class XcodeLogFormatter: LogFormatter
- returns: A `String` representation of `entry`, or `nil` if the
receiver could not format the `LogEntry`.
*/
open func format(_ entry: LogEntry) -> String?
public func format(_ entry: LogEntry) -> String?
{
return traceFormatter.format(entry) ?? defaultFormatter.format(entry)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/XcodeTraceLogFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public final class XcodeTraceLogFormatter: FieldBasedLogFormatter
- returns: A `String` representation of `entry`, or `nil` if the
receiver could not format the `LogEntry`.
*/
open override func format(_ entry: LogEntry)
public override func format(_ entry: LogEntry)
-> String?
{
guard case .trace = entry.payload else {
Expand Down