Permalink
Browse files

Rename logging enums :P

  • Loading branch information...
1 parent 4bef8e4 commit 3adc1d82dcbb5e7ab6886664f44e3d7c94217e6b @casademora casademora committed May 17, 2014
@@ -13,51 +13,51 @@
@since Available in v2.3 and later.
*/
-typedef NS_ENUM (NSInteger, MagicalRecordLogLevel)
+typedef NS_ENUM (NSInteger, MagicalRecordLoggingMask)
{
/** Disable all logging */
- MagicalRecordLogLevelOff = 0,
+ MagicalRecordLoggingMaskOff = 0,
/** Log fatal errors */
- MagicalRecordLogLevelFatal = 1 << 0,
+ MagicalRecordLoggingMaskFatal = 1 << 0,
/** Log all errors */
- MagicalRecordLogLevelError = 1 << 1,
+ MagicalRecordLoggingMaskError = 1 << 1,
/** Log warnings, and all errors */
- MagicalRecordLogLevelWarn = 1 << 2,
+ MagicalRecordLoggingMaskWarn = 1 << 2,
/** Log informative messagess, warnings and all errors */
- MagicalRecordLogLevelInfo = 1 << 3,
+ MagicalRecordLoggingMaskInfo = 1 << 3,
/** Log verbose diagnostic information, messages, warnings and all errors */
- MagicalRecordLogLevelVerbose = 1 << 4,
+ MagicalRecordLoggingMaskVerbose = 1 << 4,
};
/**
Defines a mask for logging that will be used by to filter log messages.
@since Available in v2.3 and later.
*/
-typedef NS_ENUM (NSInteger, MagicalRecordLoggingMask)
+typedef NS_ENUM (NSInteger, MagicalRecordLoggingLevel)
{
/** Don't log anything */
- MagicalRecordLogMaskOff = 0,
+ MagicalRecordLoggingLevelOff = 0,
/** Log all fatal messages */
- MagicalRecordLoggingMaskFatal = (MagicalRecordLogLevelFatal),
+ MagicalRecordLoggingLevelFatal = (MagicalRecordLoggingMaskFatal),
/** Log all errors and fatal messages */
- MagicalRecordLoggingMaskError = (MagicalRecordLogLevelFatal | MagicalRecordLogLevelError),
+ MagicalRecordLoggingLevelError = (MagicalRecordLoggingMaskFatal | MagicalRecordLoggingMaskError),
/** Log warnings, errors and fatal messages */
- MagicalRecordLoggingMaskWarn = (MagicalRecordLogLevelFatal | MagicalRecordLogLevelError | MagicalRecordLogLevelWarn),
+ MagicalRecordLoggingLevelWarn = (MagicalRecordLoggingMaskFatal | MagicalRecordLoggingMaskError | MagicalRecordLoggingMaskWarn),
/** Log informative, warning and error messages */
- MagicalRecordLoggingMaskInfo = (MagicalRecordLogLevelFatal | MagicalRecordLogLevelError | MagicalRecordLogLevelWarn | MagicalRecordLogLevelInfo),
+ MagicalRecordLoggingLevelInfo = (MagicalRecordLoggingMaskFatal | MagicalRecordLoggingMaskError | MagicalRecordLoggingMaskWarn | MagicalRecordLoggingMaskInfo),
/** Log verbose diagnostic, informative, warning and error messages */
- MagicalRecordLoggingMaskVerbose = (MagicalRecordLogLevelFatal | MagicalRecordLogLevelError | MagicalRecordLogLevelWarn | MagicalRecordLogLevelInfo | MagicalRecordLogLevelVerbose),
+ MagicalRecordLoggingLevelVerbose = (MagicalRecordLoggingMaskFatal | MagicalRecordLoggingMaskError | MagicalRecordLoggingMaskWarn | MagicalRecordLoggingMaskInfo | MagicalRecordLoggingMaskVerbose),
};
/**
Provides options for configuring MagicalRecord.
@@ -71,19 +71,19 @@ typedef NS_ENUM (NSInteger, MagicalRecordLoggingMask)
/**
Returns the logging mask set for MagicalRecord in the current application.
- @return Current MagicalRecordLogMask
+ @return Current MagicalRecordLogLevel
@since Available in v2.3 and later.
*/
-+ (MagicalRecordLoggingMask) loggingMask;
++ (MagicalRecordLoggingLevel) loggingLevel;
/**
Sets the logging mask set for MagicalRecord in the current application.
- @param mask Any value from MagicalRecordLogMask
+ @param level Any value from MagicalRecordLogLevel
@since Available in v2.3 and later.
*/
-+ (void) setLoggingMask:(MagicalRecordLoggingMask)mask;
++ (void) setLoggingLevel:(MagicalRecordLoggingLevel)level;
@end
@@ -8,18 +8,18 @@
#import "MagicalRecord+Options.h"
-static MagicalRecordLoggingMask kMagicalRecordLoggingMask = MagicalRecordLoggingMaskVerbose;
+static MagicalRecordLoggingLevel magicalRecordLoggingLevel = MagicalRecordLoggingLevelVerbose;
@tonyarnold

tonyarnold May 18, 2014

Contributor

I think it would be better to default to a lower logging level out of the box — something like MagicalRecordLoggingLevelInfo or MagicalRecordLoggingLevelWarn. The amount of logging generated by MagicalRecordLoggingLevelVerbose is a bit daunting as a first run experience.

@implementation MagicalRecord (Options)
-+ (MagicalRecordLoggingMask) loggingMask;
++ (MagicalRecordLoggingLevel) loggingLevel;
{
- return kMagicalRecordLoggingMask;
+ return magicalRecordLoggingLevel;
}
-+ (void) setLoggingMask:(MagicalRecordLoggingMask)mask;
++ (void) setLoggingLevel:(MagicalRecordLoggingLevel)level;
{
- kMagicalRecordLoggingMask = mask;
+ magicalRecordLoggingLevel = level;
}
@end
@@ -36,17 +36,17 @@ LOG_MAYBE(async, lvl, flg, ctx, __FUNCTION__, frmt, ##__VA_ARGS__)
#endif
-#define MRLogFatal(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingMask], MagicalRecordLogLevelFatal, 0, frmt, ##__VA_ARGS__)
-#define MRLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingMask], MagicalRecordLogLevelError, 0, frmt, ##__VA_ARGS__)
-#define MRLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, [MagicalRecord loggingMask], MagicalRecordLogLevelWarn, 0, frmt, ##__VA_ARGS__)
-#define MRLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, [MagicalRecord loggingMask], MagicalRecordLogLevelInfo, 0, frmt, ##__VA_ARGS__)
-#define MRLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, [MagicalRecord loggingMask], MagicalRecordLogLevelVerbose, 0, frmt, ##__VA_ARGS__)
-
-#define MRLogCFatal(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingMask], MagicalRecordLogLevelFatal, 0, frmt, ##__VA_ARGS__)
-#define MRLogCError(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingMask], MagicalRecordLogLevelError, 0, frmt, ##__VA_ARGS__)
-#define MRLogCWarn(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_WARN, [MagicalRecord loggingMask], MagicalRecordLogLevelWarn, 0, frmt, ##__VA_ARGS__)
-#define MRLogCInfo(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_INFO, [MagicalRecord loggingMask], MagicalRecordLogLevelInfo, 0, frmt, ##__VA_ARGS__)
-#define MRLogCVerbose(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_VERBOSE, [MagicalRecord loggingMask], MagicalRecordLogLevelVerbose, 0, frmt, ##__VA_ARGS__)
+#define MRLogFatal(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelFatal, 0, frmt, ##__VA_ARGS__)
+#define MRLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelError, 0, frmt, ##__VA_ARGS__)
+#define MRLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelWarn, 0, frmt, ##__VA_ARGS__)
+#define MRLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelInfo, 0, frmt, ##__VA_ARGS__)
+#define MRLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelVerbose, 0, frmt, ##__VA_ARGS__)
+
+#define MRLogCFatal(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelFatal, 0, frmt, ##__VA_ARGS__)
+#define MRLogCError(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_ERROR, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelError, 0, frmt, ##__VA_ARGS__)
+#define MRLogCWarn(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_WARN, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelWarn, 0, frmt, ##__VA_ARGS__)
+#define MRLogCInfo(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_INFO, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelInfo, 0, frmt, ##__VA_ARGS__)
+#define MRLogCVerbose(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_VERBOSE, [MagicalRecord loggingLevel], MagicalRecordLoggingLevelVerbose, 0, frmt, ##__VA_ARGS__)
#else

0 comments on commit 3adc1d8

Please sign in to comment.