This repository was archived by the owner on Feb 15, 2018. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathMDCLogController.h
More file actions
68 lines (58 loc) · 3.14 KB
/
Copy pathMDCLogController.h
File metadata and controls
68 lines (58 loc) · 3.14 KB
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
//
// MDCLogController.h
// DeveloperMenu
//
// Created by Matthew Cheetham on 02/02/2014.
// Copyright (c) 2014 Matthew Cheetham. All rights reserved.
//
#import "MDCLog.h"
/*
MDCLogDebug
The lowest priority, and normally not logged except for messages from the kernel.
--
MDCLogInfo
The lowest priority that you would normally log, and purely informational in nature.
--
MDCLogNotice
Things of moderate interest to the user or administrator.
--
MDCLogWarning
Something is amiss and might fail if not corrected.
--
MDCLogErr
Something has failed.
--
MDCLogCrit
A failure in a key system.
--
MDCLogAlert
A serious failure in a key system.
--
MDCLogEmerg
The highest priority, usually reserved for catastrophic failures and reboot notices.
*/
#define MDCLog(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelDebug function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogDebug(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelDebug function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogInfo(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelInfo function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogNotice(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelNotice function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogWarning(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelWarning function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogErr(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelErr function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogCrit(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelCrit function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogAlert(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelAlert function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
#define MDCLogEmerg(format, ...) [[MDCLogController sharedController] addLogWithLevel:MDCLogLevelEmerg function:__PRETTY_FUNCTION__ logContent:format, ##__VA_ARGS__]
@interface MDCLogController : NSObject
@property (nonatomic, strong) NSMutableArray *deviceLogs;
+ (MDCLogController *)sharedController;
typedef void (^MDCCreateLogCompletion)(NSURL *filePath, NSError *error);
/**
Adds a log to the device console as well as storing it for viewing in the developer panel. This method should not be invoked manually but should be used with one of the MDCLog macros.
@param logLevel An MDCLogLevel enum defining the current log level
@param logContent An NSString of the content that needs to be written to the log appended with any VA_ARGS for string formatting
**/
- (void)addLogWithLevel:(MDCLogLevel)logLevel function:(const char *)function logContent:(NSString *)logContent, ...;
/**
Generates a log file to be saved to the documents directory of the application
@param completion A MDCCreateLogCompletion block to be fired when the task is complete
**/
- (void)generateLogFileWithCompletion:(MDCCreateLogCompletion)completion;
@end