Skip to content

A small logging library for Objective-C applications (Mac OS X and iPhone OS/iOS) which provides conditional logging based on log levels and log components. Additionally, different logging strategies can be used, e.g. writing log messages to a file or sending them to the system log, while using the same logging interface.

Notifications You must be signed in to change notification settings

alexnauda/LibComponentLogging-Core

 
 

Repository files navigation

LibComponentLogging-Core

http://0xc0.de/LibComponentLogging
http://github.com/aharren/LibComponentLogging-Core

Overview

LibComponentLogging is a small logging library for Objective-C on Mac OS X and iOS which provides log levels, log components, and pluggable logging back-ends, e.g. writing log messages to a file, or sending them to the system log.

LibComponentLogging is available under the terms of the MIT license.

This Git repository contains the library's Core part.

Example

After configuring a logging back-end, e.g. the LogFile back-end, you can simply start logging (to the log file) by using LibComponentLogging's standard logging macro lcl_log(...), e.g.

lcl_log(lcl_cMyComponent, lcl_vError, @"message ...");

The LogFile logger uses the format

<date> <time> <pid>:<tid> <level> <component>:<file>:<line>:<function> <message>

and produces the output

2009-02-01 12:38:32.796 4964:10b D component1:main.m:28:-[Class method] Message
2009-02-01 12:38:32.798 4964:10b D component2:main.m:32:-[Class method] Message
2009-02-01 12:38:32.799 4964:10b D component3:main.m:36:-[Class method] Message

See http://0xc0.de/LibComponentLogging for more information about LibComponentLogging and more examples.

Installation

Download the files of the library Core and a logging back-end, e.g. the LogFile logger, from their repositories on GitHub:

Extract the files and copy the extracted files to your application's source directory.

Open Xcode and add all files of the library to your application's project. Xcode will automatically add the library's implementation files to your project's target.

Create a lcl_config_logger.h file and set up the logger, e.g. set the maximum file size and the name of the log file for the LogFile logger.

Create a lcl_config_extensions.h file and optionally add #import statements for logging extensions.

Create your application's lcl_config_components.h file.

Add a #import statement for lcl.h to your application files, e.g. to your application's prefix header file.

Define your log components in lcl_config_components.h.

Add lcl_log(...) log statements to your application.

See http://0xc0.de/LibComponentLogging#Installation for more information about installing and configuring LibComponentLogging.

Repository Branches

The Git repository contains the following branches:

  • master: The master branch contains stable builds of the main logging code which are tagged with version numbers.

  • devel: The devel branch is the development branch for the logging code which contains an Xcode project and unit tests. The code in this branch is not stable.

Related Repositories

The following Git repositories are related to this repository:

Copyright and License

Copyright (c) 2008-2013 Arne Harren [email protected]

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.

About

A small logging library for Objective-C applications (Mac OS X and iPhone OS/iOS) which provides conditional logging based on log levels and log components. Additionally, different logging strategies can be used, e.g. writing log messages to a file or sending them to the system log, while using the same logging interface.

Resources

Stars

Watchers

Forks

Packages

No packages published