TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
A subclass of UIImageView which loads image from URL asynchronously, with activity indicator on top.
Just copy all the classes from the /PPLogger
directory to your project, then add the following to import:
#inport "PPLogger.h"
You may want to add the import statement to your AppName-Prefix.pch so that PPLogger macros PPLog
and PPLog...
could be available to all classes.
Furthermore, if you are already using a lot of NSLog, and do not want to change, you may define the PPLOGGER_SWIZZLE_NSLOG
constant before importing PPLogger.h
:
#define PPLOGGER_SWIZZLE_NSLOG
import "PPLogger.h"
PPLog
and PPLog...
macros both uses the instance method of [PPLogger sharedInstance]
. You may configure the shared instance in your app delegate (or anywhere before logs).
[PPLogger sharedInstance]
provides a set of default configuration through its configuration
property. It should fit the default usage, namely:
If you use other ways to determine the environments (such as Develop, Staging and Production), you may configure the configuration accordingly:
PPLoggerConfiguration *configuration = [[PPLogger sharedInstance] configuration];
[configuration setDefaultSeverity:PPLoggerSeverityDebug];
#ifdef DEVELOP
[configuration setMinimumSeverity:PPLoggerSeverityDebug];
[configuration setDefaultVerbosity:PPLoggerVerbosityDetailed];
#endif
#ifdef STAGING
[configuration setMinimumSeverity:PPLoggerSeverityInfo];
[configuration setDefaultVerbosity:PPLoggerVerbosityDetailed];
#endif
#ifdef PRODUCTION
[configuration setMinimumSeverity:PPLoggerSeverityInfo];
[configuration setDefaultVerbosity:PPLoggerVerbosityPlain];
#endif
It is not recommented to show all logs to the user. Because there could be some sensitive data that should not be logged, or just too much details that the user does not need to know.
Because of this, PPLog
macro, by the default configuration, logs to DEBUG level which is ignored when released.
So you may use PPLog
(or NSLog
if you defined PPLOGGER_SWIZZLE_NSLOG
constant) for logging debug information for development use.
However, there are times you really want to leave some logs on the production release. Such as the reasons why some operation fails, or something not expected during development.
In this case, you may use PPLogDebug
, PPLogInfo
, PPLogWarn
, PPLogError
and PPLogFatal
macros to log explicitly to the level you want.
All these macros uses PPLoggerVerbosityUNSET
, which will translate to the debug verbosity of the configuration.
There is also a macro PPLogBase
which is the base method of all the above macros. You may explicitly set the severity and verbosity. However, the above macros should already be enough and in most of the case you should not need to use this one (and actually not recommended to use PPLogBase
).
PPLogger is made available under the MIT License:
The MIT License (MIT) Copyright (c) 2014 Peter Wong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.