/*
 *  BELogMacros.h
 *
 *  Created by Philipp on 17/05/2008.
 *  Copyright 2007 Incredible Bee Ltd. All rights reserved.
 *
 */

/*
 * BELog provides log macros to help debug your application.
 *
 * Use DLog for log strings you only want to appear in your Debug build; use
 * ALog for log strings you want to appear in all builds.
 *
 * The macros `DLog` and `ALog` are similar to `NSLog` but additionally prefix
 * the string with the class name, method name and line number where the macros
 * are used. The difference is that `DLog` statements are only printed in debug
 * builds, while `ALog` statements are printed in all builds.
 *
 * Both DLog and ALog prefix the log string with the class name, method name
 * and line number. The syntax is identical to NSLog, so you can use format
 * specifiers.
 *
 * Based on: http://stackoverflow.com/questions/969130/nslog-tips-and-tricks
 *
 * Important: you need to set `BE_DEBUG` (for example as a build setting) to
 * enable `DLog`s.
 */
#ifdef BE_DEBUG
#   define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#   define DLog(...)
#endif
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

/**
 * Takes a `BOOL` value and converts it to a string. This is useful in log
 * statements, for example
 *
 *     NSLog(@"Is %d a large number? %@", aNum, NSStringFromBOOL(aNum > 1000));
 */
#define NSStringFromBOOL(aBOOL) (aBOOL ? @"YES" : @"NO")
