Latest 0.1.0
Homepage https://github.com/bbc/simple-logger-ios
License Apache License, Version 2.0
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

This framework provides a simple set of convenience wrapper functions for writing to ASL (Apple System
Log). It is an extension of this logger: https://github.com/MikeWeller/MWLogging/blob/master/MWLogging.h

It supports a compile-time log level by setting the value of the preprocessor macro
MW_COMPILE_TIME_LOG_LEVEL.

Overview

To control the logging level at compile time, set the value of the preprocessor
macro MW_COMPILE_TIME_LOG_LEVEL. The log levels are the constants defined in asl.h:

#define ASL_LEVEL_EMERG   0
#define ASL_LEVEL_ALERT   1
#define ASL_LEVEL_CRIT    2
#define ASL_LEVEL_ERR     3
#define ASL_LEVEL_WARNING 4
#define ASL_LEVEL_NOTICE  5
#define ASL_LEVEL_INFO    6
#define ASL_LEVEL_DEBUG   7

For a description of when to use each level, see here:
http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/LoggingErrorsAndWarnings.html#//apple_ref/doc/uid/10000172i-SW8-SW1

  • Emergency (level 0) – The highest priority, usually reserved for
    catastrophic failures and reboot notices.
  • Alert (level 1) – A serious failure in a key system.
  • Critical (level 2) – A failure in a key system.
  • Error (level 3) – Something has failed.
  • Warning (level 4) – Something is amiss and might fail if not corrected.
  • Notice (level 5) – Things of moderate interest to the user or administrator.
  • Info (level 6) – The lowest priority that you would normally log, and purely informational in nature.
  • Debug (level 7) – The lowest priority, and normally not logged except for messages from the kernel.

Note that by default the iOS syslog/console will only record items up to level ASL_LEVEL_NOTICE.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

simple-logger-ios is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "simple-logger-ios"

How to use

Import the header files

#import <simple-logger-ios/MWLogging.h>

Use logging functions

Call the appropriate function for the logging level you wish to log at. For example:

MWLogDebug("Logging message at ASL_LEVEL_DEBUG");
MWLogError("Logging message at ASL_LEVEL_ERR");

The logging message can include formatting for additional parameters, as per [NSString initWithFormat], for example:

int numItems = 5;
...

MWLogInfo("For information there are %d items left.", numItems);

Author

Rajiv Ramdhany, rajiv.ramdhany ‘at’ bbc.co.uk

License

simple-logger-ios is developed by BBC R&D and distributed under Licensed under the Apache License, Version 2.0.

© Copyright 2016 BBC R&D. All Rights Reserved

Latest podspec

{
    "name": "simple-logger-ios",
    "version": "0.1.0",
    "summary": "Convenience wrapper functions for writing to Apple System Log",
    "description": "This framework provides a simple set of convenience wrapper functions for writing to ASL (Apple SystemnLog).nnIt supports a compile-time log level by setting the value of the preprocessor macron`MW_COMPILE_TIME_LOG_LEVEL`. This will turn the associated log callsninto NOPs.",
    "homepage": "https://github.com/bbc/simple-logger-ios",
    "license": {
        "type": "Apache License, Version 2.0",
        "file": "LICENSE"
    },
    "authors": {
        "Rajiv Ramdhany": "[email protected]"
    },
    "source": {
        "git": "https://github.com/bbc/simple-logger-ios.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "simple-logger-ios/Classes/**/*"
}

Pin It on Pinterest

Share This