This repository was archived by the owner on Feb 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMDCLog.h
More file actions
54 lines (45 loc) · 1.85 KB
/
Copy pathMDCLog.h
File metadata and controls
54 lines (45 loc) · 1.85 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
//
// MDCLog.h
// DeveloperMenu
//
// Created by Matthew Cheetham on 02/02/2014.
// Copyright (c) 2014 Matthew Cheetham. All rights reserved.
//
#include <asl.h>
typedef enum {
MDCLogLevelEmerg = ASL_LEVEL_EMERG,
MDCLogLevelAlert = ASL_LEVEL_ALERT,
MDCLogLevelCrit = ASL_LEVEL_CRIT,
MDCLogLevelErr = ASL_LEVEL_ERR,
MDCLogLevelWarning = ASL_LEVEL_WARNING,
MDCLogLevelNotice = ASL_LEVEL_NOTICE,
MDCLogLevelInfo = ASL_LEVEL_INFO,
MDCLogLevelDebug = ASL_LEVEL_DEBUG
} MDCLogLevel;
@interface MDCLog : NSObject
@property (nonatomic, assign) MDCLogLevel logLevel;
@property (nonatomic, strong) NSString *logContent;
@property (nonatomic, strong) NSDate *logTime;
/**
Used for log information for use on the log controller. This method will generally not need to be called manually but should instead by used with a MDCLog macro.
@param logContent A string containing the information you wish to log to the console
@param logLevel A enum of MDCLogLevel describing the severity of the log
@return MDCLog for use in the log controller
**/
+ (MDCLog *)logWithContent:(NSString *)logContent content:(MDCLogLevel)logLevel;
/**
Creates an NSString from the current object's log level and log content suitable for console output
@return NSString properly formatted for console output (e.g. <Debug> Testing)
**/
- (NSString *)logContentWithLevelPrefix;
/**
Creates an NSAttributedString from the current object's log level and log content suitable for output in a tableview. These logs are colour coded at the beginning for easy reference.
@return NSAttributedString containing colour coded warning level tags
**/
- (NSAttributedString *)attributedLogContentWithlevelPrefix;
/**
Creates an NSString from the current object's timestamp suitable for displaying in a log viewer
@return Formatted date string
**/
- (NSString *)friendlyTimeAndDate;
@end