summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLLoggingConfiguration.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLLoggingConfiguration.h')
-rw-r--r--platform/darwin/src/MGLLoggingConfiguration.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLLoggingConfiguration.h b/platform/darwin/src/MGLLoggingConfiguration.h
new file mode 100644
index 0000000000..b467f80d31
--- /dev/null
+++ b/platform/darwin/src/MGLLoggingConfiguration.h
@@ -0,0 +1,84 @@
+#import <Foundation/Foundation.h>
+
+#import "MGLFoundation.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ Constants indicating the message's logging level.
+ */
+typedef NS_ENUM(NSInteger, MGLLoggingLevel) {
+ /**
+ None-level messages are ignored.
+ */
+ MGLLoggingLevelNone = 0,
+ /**
+ Info-level messages contain information that may be helpful for flow tracing
+ but is not essential.
+ */
+ MGLLoggingLevelInfo,
+ /**
+ Debug-level messages contain information that may be helpful for troubleshooting
+ specific problems.
+ */
+ MGLLoggingLevelDebug,
+ /**
+ Error-level messages contain information that is intended to aid in process-level
+ errors.
+ */
+ MGLLoggingLevelError,
+ /**
+ Fault-level messages contain system-level error information.
+ */
+ MGLLoggingLevelFault,
+ /**
+ :nodoc: Any new logging level should be included in the default logging implementation.
+ */
+};
+
+/**
+ A block to be called once `loggingLevel` is set to a higher value than `MGLLoggingLevelNone`.
+
+ @param loggingLevel The message logging level.
+ @param filePath The description of the file and method for the calling message.
+ @param line The line where the message is logged.
+ @param message The logging message.
+ */
+typedef void (^MGLLoggingBlockHandler)(MGLLoggingLevel loggingLevel, NSString *filePath, NSUInteger line, NSString *message);
+
+/**
+ The `MGLLoggingConfiguration` object provides a global way to set this SDK logging levels
+ and logging handler.
+ */
+MGL_EXPORT
+@interface MGLLoggingConfiguration : NSObject
+
+/**
+ The handler this SDK uses to log messages.
+
+ If this property is set to nil or if no custom handler is provided this property
+ is set to the default handler.
+
+ The default handler uses `os_log` and `NSLog` for iOS 10+ and iOS < 10 respectively.
+ */
+@property (nonatomic, copy, null_resettable) MGLLoggingBlockHandler handler;
+
+/**
+ The logging level.
+
+ The default value is `MGLLoggingLevelNone`.
+
+ Setting this property includes logging levels less than or equal to the setted value.
+ */
+@property (assign, nonatomic) MGLLoggingLevel loggingLevel;
+
+/**
+ Returns the shared logging object.
+ */
+@property (class, nonatomic, readonly) MGLLoggingConfiguration *sharedConfiguration;
+
+- (MGLLoggingBlockHandler)handler UNAVAILABLE_ATTRIBUTE;
+
+@end
+
+NS_ASSUME_NONNULL_END