issue #4892:Implement logical codes of game controller

This commit is contained in:
Dhilan007 2014-06-30 00:30:46 +08:00
parent 7cd7b9e054
commit bde1887b28
6 changed files with 3370 additions and 0 deletions

24
external/nslog/CCNSLog.h vendored Normal file
View File

@ -0,0 +1,24 @@
//
// MyLog.h
// cocos2d_libs
//
// Created by James Chen on 4/23/14.
//
//
#ifndef __cocos2d_libs__MyLog__
#define __cocos2d_libs__MyLog__
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
extern void CCNSLog(const char* file, int line, const char* function, const char* format, ...);
#define CCNSLOG(format, ...) CCNSLog(__FILE__, __LINE__, __FUNCTION__, format, ##__VA_ARGS__, nullptr)
#else
#define CCNSLOG CCLOG
#endif
#endif /* defined(__cocos2d_libs__MyLog__) */

27
external/nslog/ios/CCNSLog.mm vendored Normal file
View File

@ -0,0 +1,27 @@
//
// MyLog.cpp
// cocos2d_libs
//
// Created by James Chen on 4/23/14.
//
//
#include "CCNSLog.h"
#import "NSLogger.h"
void CCNSLog(const char* file, int line, const char* function, const char* format, ...)
{
va_list args;
va_start(args, format);
char buf[1024 * 16] = {0};
vsprintf(buf, format, args);
va_end(args);
LogMessageF(file, line, function, @"cocos2d-x", 0, [NSString stringWithUTF8String:buf], nullptr);
// LoggerFlush(LoggerGetDefaultLogger(), YES);
}

248
external/nslog/ios/LoggerClient.h vendored Normal file
View File

@ -0,0 +1,248 @@
/*
* LoggerClient.h
*
* version 1.5-RC2 22-NOV-2013
*
* Part of NSLogger (client side)
* https://github.com/fpillet/NSLogger
*
* BSD license follows (http://www.opensource.org/licenses/bsd-license.php)
*
* Copyright (c) 2010-2013 Florent Pillet All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. Neither the name of Florent
* Pillet nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#import <unistd.h>
#import <pthread.h>
#import <dispatch/once.h>
#import <libkern/OSAtomic.h>
#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#if !TARGET_OS_IPHONE
#import <CoreServices/CoreServices.h>
#endif
// This define is here so that user application can test whether NSLogger Client is
// being included in the project, and potentially configure their macros accordingly
#define NSLOGGER_WAS_HERE 1
// Set this to 0 if you absolutely NOT want any access to Cocoa (Objective-C, NS* calls)
// We need a couple ones to reliably obtain the thread number and device information
// Note that since we need NSAutoreleasePool when using Cocoa in the logger's worker thread,
// we need to put Cocoa in multithreading mode. Also, ALLOW_COCOA_USE allows the client code
// to use NSLog()-style message formatting (less verbose than CFShow()-style) through the
// use of -[NSString stringWithFormat:arguments:]
#define ALLOW_COCOA_USE 1
/* -----------------------------------------------------------------
* Logger option flags & default options
* -----------------------------------------------------------------
*/
enum {
kLoggerOption_LogToConsole = 0x01,
kLoggerOption_BufferLogsUntilConnection = 0x02,
kLoggerOption_BrowseBonjour = 0x04,
kLoggerOption_BrowseOnlyLocalDomain = 0x08,
kLoggerOption_UseSSL = 0x10,
kLoggerOption_CaptureSystemConsole = 0x20
};
#define LOGGER_DEFAULT_OPTIONS (kLoggerOption_BufferLogsUntilConnection | \
kLoggerOption_BrowseBonjour | \
kLoggerOption_BrowseOnlyLocalDomain | \
kLoggerOption_UseSSL | \
kLoggerOption_CaptureSystemConsole)
/* -----------------------------------------------------------------
* Structure defining a Logger
* -----------------------------------------------------------------
*/
typedef struct
{
CFStringRef bufferFile; // If non-NULL, all buffering is done to the specified file instead of in-memory
CFStringRef host; // Viewer host to connect to (instead of using Bonjour)
UInt32 port; // port on the viewer host
CFMutableArrayRef bonjourServiceBrowsers; // Active service browsers
CFMutableArrayRef bonjourServices; // Services being tried
CFNetServiceBrowserRef bonjourDomainBrowser; // Domain browser
CFMutableArrayRef logQueue; // Message queue
pthread_mutex_t logQueueMutex;
pthread_cond_t logQueueEmpty;
dispatch_once_t workerThreadInit; // Use this to ensure creation of the worker thread is ever done only once for a given logger
pthread_t workerThread; // The worker thread responsible for Bonjour resolution, connection and logs transmission
CFRunLoopSourceRef messagePushedSource; // A message source that fires on the worker thread when messages are available for send
CFRunLoopSourceRef bufferFileChangedSource; // A message source that fires on the worker thread when the buffer file configuration changes
CFRunLoopSourceRef remoteOptionsChangedSource; // A message source that fires when option changes imply a networking strategy change (switch to/from Bonjour, direct host or file streaming)
CFWriteStreamRef logStream; // The connected stream we're writing to
CFWriteStreamRef bufferWriteStream; // If bufferFile not NULL and we're not connected, points to a stream for writing log data
CFReadStreamRef bufferReadStream; // If bufferFile not NULL, points to a read stream that will be emptied prior to sending the rest of in-memory messages
SCNetworkReachabilityRef reachability; // The reachability object we use to determine when the target host becomes reachable
SCNetworkReachabilityFlags reachabilityFlags; // Last known reachability flags - we use these to detect network transitions without network loss
CFRunLoopTimerRef reconnectTimer; // A timer to regularly check connection to the defined host, along with reachability for added reliability
uint8_t *sendBuffer; // data waiting to be sent
NSUInteger sendBufferSize;
NSUInteger sendBufferUsed; // number of bytes of the send buffer currently in use
NSUInteger sendBufferOffset; // offset in sendBuffer to start sending at
int32_t messageSeq; // sequential message number (added to each message sent)
// settings
uint32_t options; // Flags, see enum above
CFStringRef bonjourServiceType; // leave NULL to use the default
CFStringRef bonjourServiceName; // leave NULL to use the first one available
// internal state
BOOL targetReachable; // Set to YES when the Reachability target (host or internet) is deemed reachable
BOOL connected; // Set to YES once the write stream declares the connection open
volatile BOOL quit; // Set to YES to terminate the logger worker thread's runloop
BOOL incompleteSendOfFirstItem; // set to YES if we are sending the first item in the queue and it's bigger than what the buffer can hold
} Logger;
/* -----------------------------------------------------------------
* LOGGING FUNCTIONS
* -----------------------------------------------------------------
*/
#ifdef __cplusplus
extern "C" {
#endif
// Set the default logger which will be the one used when passing NULL for logge
extern void LoggerSetDefaultLogger(Logger *aLogger);
// Get the default logger, create one if it does not exist
extern Logger *LoggerGetDefaultLogger(void);
// Checks whether the default logger exists, returns it if YES, otherwise do NO create one
extern Logger *LoggerCheckDefaultLogger(void);
// Initialize a new logger, set as default logger if this is the first one
// Options default to:
// - logging to console = NO
// - buffer until connection = YES
// - browse Bonjour = YES
// - browse only locally on Bonjour = YES
extern Logger* LoggerInit(void);
// Set logger options if you don't want the default options (see above)
extern void LoggerSetOptions(Logger *logger, uint32_t options);
// Set Bonjour logging names, so you can force the logger to use a specific service type
// or direct logs to the machine on your network which publishes a specific name
extern void LoggerSetupBonjour(Logger *logger, CFStringRef bonjourServiceType, CFStringRef bonjourServiceName);
// Directly set the viewer host (hostname or IP address) and port we want to connect to. If set, LoggerStart() will
// try to connect there first before trying Bonjour
extern void LoggerSetViewerHost(Logger *logger, CFStringRef hostName, UInt32 port);
// Configure the logger to use a local file for buffering, instead of memory.
// - If you initially set a buffer file after logging started but while a logger connection
// has not been acquired, the contents of the log queue will be written to the buffer file
// the next time a logging function is called, or when LoggerStop() is called.
// - If you want to change the buffering file after logging started, you should first
// call LoggerStop() the call LoggerSetBufferFile(). Note that all logs stored in the previous
// buffer file WON'T be transferred to the new file in this case.
extern void LoggerSetBufferFile(Logger *logger, CFStringRef absolutePath);
// Activate the logger, try connecting. You can pass NULL to start the default logger,
// it will return a pointer to it.
extern Logger* LoggerStart(Logger *logger);
//extern void LoggerConnectToHost(CFDataRef address, int port);
// Deactivate and free the logger.
extern void LoggerStop(Logger *logger);
// Pause the current thread until all messages from the logger have been transmitted
// this is useful to use before an assert() aborts your program. If waitForConnection is YES,
// LoggerFlush() will block even if the client is not currently connected to the desktop
// viewer. You should be using NO most of the time, but in some cases it can be useful.
extern void LoggerFlush(Logger *logger, BOOL waitForConnection);
/* Logging functions. Each function exists in four versions:
*
* - one without a Logger instance (uses default logger) and without filename/line/function (no F suffix)
* - one without a Logger instance but with filename/line/function (F suffix)
* - one with a Logger instance (use a specific Logger) and without filename/line/function (no F suffix)
* - one with a Logger instance (use a specific Logger) and with filename/line/function (F suffix)
*
* The exception being the single LogMessageCompat() function which is designed to be a drop-in replacement for NSLog()
*
*/
// Log a message, calling format compatible with NSLog
extern void LogMessageCompat(NSString *format, ...);
// Log a message without any formatting (just log the given string)
extern void LogMessageRaw(NSString *message);
extern void LogMessageRawF(const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSString *message);
extern void LogMessageRawToF(Logger *logger, const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSString *message);
// Log a message. domain can be nil if default domain.
extern void LogMessage(NSString *domain, int level, NSString *format, ...) NS_FORMAT_FUNCTION(3,4);
extern void LogMessageF(const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSString *format, ...) NS_FORMAT_FUNCTION(6,7);
extern void LogMessageTo(Logger *logger, NSString *domain, int level, NSString *format, ...) NS_FORMAT_FUNCTION(4,5);
extern void LogMessageToF(Logger *logger, const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSString *format, ...) NS_FORMAT_FUNCTION(7,8);
// Log a message. domain can be nil if default domain (versions with va_list format args instead of ...)
extern void LogMessage_va(NSString *domain, int level, NSString *format, va_list args) NS_FORMAT_FUNCTION(3,0);
extern void LogMessageF_va(const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSString *format, va_list args) NS_FORMAT_FUNCTION(6,0);
extern void LogMessageTo_va(Logger *logger, NSString *domain, int level, NSString *format, va_list args) NS_FORMAT_FUNCTION(4,0);
extern void LogMessageToF_va(Logger *logger, const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSString *format, va_list args) NS_FORMAT_FUNCTION(7,0);
// Send binary data to remote logger
extern void LogData(NSString *domain, int level, NSData *data);
extern void LogDataF(const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSData *data);
extern void LogDataTo(Logger *logger, NSString *domain, int level, NSData *data);
extern void LogDataToF(Logger *logger, const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, NSData *data);
// Send image data to remote logger
extern void LogImageData(NSString *domain, int level, int width, int height, NSData *data);
extern void LogImageDataF(const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, int width, int height, NSData *data);
extern void LogImageDataTo(Logger *logger, NSString *domain, int level, int width, int height, NSData *data);
extern void LogImageDataToF(Logger *logger, const char *filename, int lineNumber, const char *functionName, NSString *domain, int level, int width, int height, NSData *data);
// Mark the start of a block. This allows the remote logger to group blocks together
extern void LogStartBlock(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
extern void LogStartBlockTo(Logger *logger, NSString *format, ...) NS_FORMAT_FUNCTION(2,3);
// Mark the end of a block
extern void LogEndBlock(void);
extern void LogEndBlockTo(Logger *logger);
// Log a marker (text can be null)
extern void LogMarker(NSString *text);
extern void LogMarkerTo(Logger *logger, NSString *text);
#ifdef __cplusplus
};
#endif

2866
external/nslog/ios/LoggerClient.m vendored Normal file

File diff suppressed because it is too large Load Diff

113
external/nslog/ios/LoggerCommon.h vendored Normal file
View File

@ -0,0 +1,113 @@
/*
* LoggerCommon.h
*
* version 1.5-RC2 22-NOV-2013
*
* Definitions common to NSLogger Viewer and NSLoggerClient
* for the binary messages format
* https://github.com/fpillet/NSLogger
*
* BSD license follows (http://www.opensource.org/licenses/bsd-license.php)
*
* Copyright (c) 2010-2013 Florent Pillet All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. Neither the name of Florent
* Pillet nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* NSLogger native binary message format:
* Each message is a dictionary encoded in a compact format. All values are stored
* in network order (big endian). A message is made of several "parts", which are
* typed chunks of data, each with a specific purpose (partKey), data type (partType)
* and data size (partSize).
*
* uint32_t totalSize (total size for the whole message excluding this 4-byte count)
* uint16_t partCount (number of parts below)
* [repeat partCount times]:
* uint8_t partKey the part key
* uint8_t partType (string, binary, image, int16, int32, int64)
* uint32_t partSize (only for string, binary and image types, others are implicit)
* .. `partSize' data bytes
*
* Complete message is usually made of:
* - a PART_KEY_MESSAGE_TYPE (mandatory) which contains one of the LOGMSG_TYPE_* values
* - a PART_KEY_TIMESTAMP_S (mandatory) which is the timestamp returned by gettimeofday() (seconds from 01.01.1970 00:00)
* - a PART_KEY_TIMESTAMP_MS (optional) complement of the timestamp seconds, in milliseconds
* - a PART_KEY_TIMESTAMP_US (optional) complement of the timestamp seconds and milliseconds, in microseconds
* - a PART_KEY_THREAD_ID (mandatory) the ID of the user thread that produced the log entry
* - a PART_KEY_TAG (optional) a tag that helps categorizing and filtering logs from your application, and shows up in viewer logs
* - a PART_KEY_LEVEL (optional) a log level that helps filtering logs from your application (see as few or as much detail as you need)
* - a PART_KEY_MESSAGE which is the message text, binary data or image
* - a PART_KEY_MESSAGE_SEQ which is the message sequence number (message# sent by client)
* - a PART_KEY_FILENAME (optional) with the filename from which the log was generated
* - a PART_KEY_LINENUMBER (optional) the linenumber in the filename at which the log was generated
* - a PART_KEY_FUNCTIONNAME (optional) the function / method / selector from which the log was generated
* - if logging an image, PART_KEY_IMAGE_WIDTH and PART_KEY_IMAGE_HEIGHT let the desktop know the image size without having to actually decode it
*/
// Constants for the "part key" field
#define PART_KEY_MESSAGE_TYPE 0
#define PART_KEY_TIMESTAMP_S 1 // "seconds" component of timestamp
#define PART_KEY_TIMESTAMP_MS 2 // milliseconds component of timestamp (optional, mutually exclusive with PART_KEY_TIMESTAMP_US)
#define PART_KEY_TIMESTAMP_US 3 // microseconds component of timestamp (optional, mutually exclusive with PART_KEY_TIMESTAMP_MS)
#define PART_KEY_THREAD_ID 4
#define PART_KEY_TAG 5
#define PART_KEY_LEVEL 6
#define PART_KEY_MESSAGE 7
#define PART_KEY_IMAGE_WIDTH 8 // messages containing an image should also contain a part with the image size
#define PART_KEY_IMAGE_HEIGHT 9 // (this is mainly for the desktop viewer to compute the cell size without having to immediately decode the image)
#define PART_KEY_MESSAGE_SEQ 10 // the sequential number of this message which indicates the order in which messages are generated
#define PART_KEY_FILENAME 11 // when logging, message can contain a file name
#define PART_KEY_LINENUMBER 12 // as well as a line number
#define PART_KEY_FUNCTIONNAME 13 // and a function or method name
// Constants for parts in LOGMSG_TYPE_CLIENTINFO
#define PART_KEY_CLIENT_NAME 20
#define PART_KEY_CLIENT_VERSION 21
#define PART_KEY_OS_NAME 22
#define PART_KEY_OS_VERSION 23
#define PART_KEY_CLIENT_MODEL 24 // For iPhone, device model (i.e 'iPhone', 'iPad', etc)
#define PART_KEY_UNIQUEID 25 // for remote device identification, part of LOGMSG_TYPE_CLIENTINFO
// Area starting at which you may define your own constants
#define PART_KEY_USER_DEFINED 100
// Constants for the "partType" field
#define PART_TYPE_STRING 0 // Strings are stored as UTF-8 data
#define PART_TYPE_BINARY 1 // A block of binary data
#define PART_TYPE_INT16 2
#define PART_TYPE_INT32 3
#define PART_TYPE_INT64 4
#define PART_TYPE_IMAGE 5 // An image, stored in PNG format
// Data values for the PART_KEY_MESSAGE_TYPE parts
#define LOGMSG_TYPE_LOG 0 // A standard log message
#define LOGMSG_TYPE_BLOCKSTART 1 // The start of a "block" (a group of log entries)
#define LOGMSG_TYPE_BLOCKEND 2 // The end of the last started "block"
#define LOGMSG_TYPE_CLIENTINFO 3 // Information about the client app
#define LOGMSG_TYPE_DISCONNECT 4 // Pseudo-message on the desktop side to identify client disconnects
#define LOGMSG_TYPE_MARK 5 // Pseudo-message that defines a "mark" that users can place in the log flow
// Default Bonjour service identifiers
#define LOGGER_SERVICE_TYPE_SSL CFSTR("_nslogger-ssl._tcp")
#define LOGGER_SERVICE_TYPE CFSTR("_nslogger._tcp")

92
external/nslog/ios/NSLogger.h vendored Normal file
View File

@ -0,0 +1,92 @@
/*
* NSLogger.h
*
* version 1.5-RC2 22-NOV-2013
*
* Part of NSLogger (client side)
* https://github.com/fpillet/NSLogger
*
* BSD license follows (http://www.opensource.org/licenses/bsd-license.php)
*
* Copyright (c) 2010-2013 Florent Pillet All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. Neither the name of Florent
* Pillet nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#import "LoggerClient.h"
// Log level usual usage:
// Level 0: errors only!
// Level 1: important informations, app states…
// Level 2: less important logs, network requests…
// Level 3: network responses, datas and images…
// Level 4: really not important stuff.
#if 0
#define NSLog(...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"NSLog", 0, __VA_ARGS__)
#define LoggerError(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Error", level, __VA_ARGS__)
#define LoggerApp(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"App", level, __VA_ARGS__)
#define LoggerView(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"View", level, __VA_ARGS__)
#define LoggerService(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Service", level, __VA_ARGS__)
#define LoggerModel(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Model", level, __VA_ARGS__)
#define LoggerData(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Data", level, __VA_ARGS__)
#define LoggerNetwork(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Network", level, __VA_ARGS__)
#define LoggerLocation(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Location", level, __VA_ARGS__)
#define LoggerPush(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Push", level, __VA_ARGS__)
#define LoggerFile(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"File", level, __VA_ARGS__)
#define LoggerSharing(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Sharing", level, __VA_ARGS__)
#define LoggerAd(level, ...) LogMessageF(__FILE__, __LINE__, __FUNCTION__, @"Ad and Stat", level, __VA_ARGS__)
#else
#define NSLog(...) LogMessageCompat(__VA_ARGS__)
#define LoggerError(...) while(0} {}
#define LoggerApp(level, ...) while(0) {}
#define LoggerView(...) while(0) {}
#define LoggerService(...) while(0) {}
#define LoggerModel(...) while(0) {}
#define LoggerData(...) while(0) {}
#define LoggerNetwork(...) while(0) {}
#define LoggerLocation(...) while(0) {}
#define LoggerPush(...) while(0) {}
#define LoggerFile(...) while(0) {}
#define LoggerSharing(...) while(0) {}
#define LoggerAd(...) while(0) {}
#endif
// Starts the logger with the username defined in the build settings.
// The build setting NSLOGGER_BUILD_USERNAME is automatically configured when NSLogger is
// added to a project using CocoaPods. To use it, just add this macro call to your main() function.
#define LoggerStartForBuildUser() LoggerSetupBonjour(LoggerGetDefaultLogger(), NULL, CFSTR(xstr(NSLOGGER_BUILD_USERNAME)))