summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLLoggingConfiguration.h
blob: b467f80d31eacab7728e2656be09fba843525624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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