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

Refactor: Add logLevel to init #10

Merged
merged 1 commit into from
Sep 25, 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
5 changes: 4 additions & 1 deletion Sources/DataDogLog/Public/DataDogLogHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public struct DataDogLogHandler: LogHandler, Sendable {
public var metadata = Logger.Metadata()

/// The minimum log level for a message to be logged. If a log's level is more severe or equal to this value, the log will be sent. Defaults to `info`.
public var logLevel = Logger.Level.info
public var logLevel: Logger.Level

/// The label to use for this handler. This is usually the service's name.
public var label: String
Expand All @@ -29,16 +29,19 @@ public struct DataDogLogHandler: LogHandler, Sendable {

/// - Parameters:
/// - label: The label to use for this handler
/// - logLevel: The minimum log level for a message to be logged
/// - key: The DataDog access key
/// - hostname: The name of the host sending logs
/// - region: The DataDog region to use, defaults to `US`
public init(
label: String,
logLevel: Logger.Level = .info,
key: String,
hostname: String? = nil,
site: Site = .US
) {
self.label = label
self.logLevel = logLevel
self.key = key
self.hostname = hostname
self.site = site
Expand Down