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

promote LogVerbosity for external use, fix lingering doc warnings #161

Merged
merged 1 commit into from
May 2, 2024
Merged
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 Sources/Automerge/Automerge.docc/Automerge.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Read <doc:FiveMinuteQuickstart> to get a quick taste of how to use Automerge, or
- ``Automerge/AutomergeEncoder``
- ``Automerge/AutomergeDecoder``
- ``Automerge/SchemaStrategy``
- ``Automerge/LogVerbosity``
- ``Automerge/AnyCodingKey``
- ``Automerge/LogVerbosity``

### Representing Objects and Values in a Document

Expand Down Expand Up @@ -118,4 +118,4 @@ Read <doc:FiveMinuteQuickstart> to get a quick taste of how to use Automerge, or
- ``Automerge/StringScalarConversionError``
- ``Automerge/TimestampScalarConversionError``
- ``Automerge/UIntScalarConversionError``

- ``Automerge/URLScalarConversionError``
2 changes: 1 addition & 1 deletion Sources/Automerge/Automerge.docc/Curation/PatchAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- ``PatchAction/DeleteMap(_:_:)``
- ``PatchAction/DeleteSeq(_:)``
- ``PatchAction/Increment(_:_:_:)``
- ``PatchAction/Insert(obj:index:values:marks:)``
- ``PatchAction/Insert(obj:index:values:)``
- ``PatchAction/Marks(_:_:)``
- ``PatchAction/Put(_:_:_:)``
- ``PatchAction/SpliceText(obj:index:value:marks:)``
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

- ``toScalarValue()``
- ``fromScalarValue(_:)``
- ``fromValue(_:)``
- ``ConvertError``
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ public enum LogVerbosity: Int, Comparable, Equatable, Sendable {
/// - lhs: The first verbosity level to compare.
/// - rhs: The second verbosity level to compare.
/// - Returns: Returns true if the first verbosity level is less than the second.
nonisolated public static func < (lhs: LogVerbosity, rhs: LogVerbosity) -> Bool {
public nonisolated static func < (lhs: LogVerbosity, rhs: LogVerbosity) -> Bool {
lhs.rawValue < rhs.rawValue
}

// loosely matching the levels from https://datatracker.ietf.org/doc/html/rfc5424

/// Log errors only.
case errorOnly = 3
/// Logs include debugging and informational detail.
case debug = 6
/// Logs include all debugging and additional tracing details.
case tracing = 8

/// Returns `true` if the verbosity level allows debug level logging, `false` otherwise.
nonisolated func canDebug() -> Bool {
public nonisolated func canDebug() -> Bool {
self >= LogVerbosity.debug
}

/// Returns `true` if the verbosity level allows trace level logging, `false` otherwise.
nonisolated func canTrace() -> Bool {
public nonisolated func canTrace() -> Bool {
self >= LogVerbosity.debug
}
}
2 changes: 1 addition & 1 deletion Sources/Automerge/ScalarValueRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
/// Implement ``ScalarValueRepresentable/toScalarValue()`` to encode your type into a relevant Automerge primitive.
/// For example, you can encode your type into a buffer of bytes, and store the result as a value by returning
/// ``ScalarValue/Bytes(_:)`` with the data embedded.
/// Implement ``ScalarValueRepresentable/fromScalarValue(_:)`` and ``ScalarValueRepresentable/fromValue(_:)`` to decode
/// Implement ``ScalarValueRepresentable/fromScalarValue(_:)`` to decode
/// the scalar value into your type.
///
/// Types that conform to ScalarValueRepresentable define a localized error type to provide information when conversion
Expand Down
Loading