SidewalkLogging

public protocol SidewalkLogging

A protocol allowing consumer to provide a logging implementation to capture Amazon Sidewalk Mobile SDK logs.

We are evaluating how to align this with the Logger struct provided in iOS14. This interface is subject to change.

  • Logs an event with the specified log type and message.

    This function allows capturing and logging events for debugging, tracking, and monitoring purposes within the Sidewalk framework. It provides a way to record logs with different levels of importance, such as default, error, info, and debug, which can be used to observe the internal behavior or performance of the system.

    Usage Example in Amazon sidewalk Mobile SDK:

    log(type: .error, message: "An error occurred while fetching data")
    

    Declaration

    Swift

    func log(type: OSLogType, message: @autoclosure () -> String)

    Parameters

    type

    The log type indicating the severity or category of the message. Use appropriate OSLogType values like .default, .error, .info, .debug, etc., to classify the log entry.

    message

    A closure that returns the message string to be logged. The closure is marked with @autoclosure, which ensures the message is only evaluated when the log is actually written, reducing unnecessary computation when logging is disabled.