Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CocoaLumberjack to 3.0.0 #196

Merged
merged 3 commits into from
Jan 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 80 additions & 78 deletions DeviceAgent.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

35 changes: 22 additions & 13 deletions Vendor/CocoaHTTPServer/Core/HTTPLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* This means you can pass it multiple variables just like NSLog.
**/

#import "DDLog.h"
#import "CocoaLumberjack.h"

// Define logging context for every log message coming from the HTTP server.
// The logging context can be extracted from the DDLogMessage from within the logging framework,
Expand All @@ -56,6 +56,14 @@

// Configure log levels.

#ifndef HTTP_LOG_LEVEL_DEF
#define HTTP_LOG_LEVEL_DEF httpLogLevel
#endif

#define THIS_FILE_C [(DDExtractFileNameWithoutExtension(__FILE__, NO)) cStringUsingEncoding:NSUTF8StringEncoding]

#define THIS_METHOD_C [NSStringFromSelector(_cmd) cStringUsingEncoding:NSUTF8StringEncoding]

#define HTTP_LOG_FLAG_ERROR (1 << 0) // 0...00001
#define HTTP_LOG_FLAG_WARN (1 << 1) // 0...00010
#define HTTP_LOG_FLAG_INFO (1 << 2) // 0...00100
Expand Down Expand Up @@ -97,24 +105,25 @@

// Define logging primitives.

#define HTTPLogError(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_ERROR, httpLogLevel, HTTP_LOG_FLAG_ERROR, \
HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__)
#define HTTPLogError(frmt, ...) LOG_MAYBE(HTTP_LOG_ASYNC_ERROR, HTTP_LOG_LEVEL_DEF, HTTP_LOG_FLAG_ERROR, HTTP_LOG_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)

#define HTTPLogWarn(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_WARN, httpLogLevel, HTTP_LOG_FLAG_WARN, \
HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__)
#define HTTPLogWarn(frmt, ...) LOG_MAYBE(HTTP_LOG_ASYNC_WARN, HTTP_LOG_LEVEL_DEF, HTTP_LOG_FLAG_WARN, HTTP_LOG_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)

#define HTTPLogInfo(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_INFO, httpLogLevel, HTTP_LOG_FLAG_INFO, \
HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__)
#define HTTPLogInfo(frmt, ...) LOG_MAYBE(HTTP_LOG_ASYNC_INFO, HTTP_LOG_LEVEL_DEF, HTTP_LOG_FLAG_INFO, HTTP_LOG_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)

#define HTTPLogVerbose(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_VERBOSE, httpLogLevel, HTTP_LOG_FLAG_VERBOSE, \
HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__)
#define HTTPLogVerbose(frmt, ...) LOG_MAYBE(HTTP_LOG_ASYNC_VERBOSE, HTTP_LOG_LEVEL_DEF, HTTP_LOG_FLAG_VERBOSE, HTTP_LOG_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)

#define HTTPLogTrace() LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_TRACE, httpLogLevel, HTTP_LOG_FLAG_TRACE, \
HTTP_LOG_CONTEXT, @"%@[%p]: %@", THIS_FILE, self, THIS_METHOD)
/*

#define HTTPLogTrace2(frmt, ...) LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_TRACE, httpLogLevel, HTTP_LOG_FLAG_TRACE, \
HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__)
// Original
#define HTTPLogTrace() LOG_OBJC_MAYBE(HTTP_LOG_ASYNC_TRACE, httpLogLevel, HTTP_LOG_FLAG_TRACE,
HTTP_LOG_CONTEXT, @"%@[%p]: %@", THIS_FILE, self, THIS_METHOD)
*/

// I have little confidence that I this is correct, but it is never called. -jjm
#define HTTPLogTrace() LOG_MAYBE(HTTP_LOG_ASYNC_TRACE, HTTP_LOG_LEVEL_DEF, HTTP_LOG_FLAG_TRACE,HTTP_LOG_CONTEXT, @"%@[%p]: %@", THIS_FILE_C, NSStringFromClass([self class]), THIS_METHOD_C)

#define HTTPLogTrace2(frmt, ...) LOG_MAYBE(HTTP_LOG_ASYNC_TRACE, HTTP_LOG_LEVEL_DEF, HTTP_LOG_FLAG_TRACE, HTTP_LOG_CONTEXT, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)

#define HTTPLogCError(frmt, ...) LOG_C_MAYBE(HTTP_LOG_ASYNC_ERROR, httpLogLevel, HTTP_LOG_FLAG_ERROR, \
HTTP_LOG_CONTEXT, frmt, ##__VA_ARGS__)
Expand Down
85 changes: 85 additions & 0 deletions Vendor/CocoaLumberjack/CocoaLumberjack.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Software License Agreement (BSD License)
//
// Copyright (c) 2010-2016, Deusty, LLC
// All rights reserved.
//
// Redistribution and use of this software 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.
//
// * Neither the name of Deusty nor the names of its contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission of Deusty, LLC.

/**
* Welcome to CocoaLumberjack!
*
* The project page has a wealth of documentation if you have any questions.
* https://github.com/CocoaLumberjack/CocoaLumberjack
*
* If you're new to the project you may wish to read "Getting Started" at:
* Documentation/GettingStarted.md
*
* Otherwise, here is a quick refresher.
* There are three steps to using the macros:
*
* Step 1:
* Import the header in your implementation or prefix file:
*
* #import <CocoaLumberjack/CocoaLumberjack.h>
*
* Step 2:
* Define your logging level in your implementation file:
*
* // Log levels: off, error, warn, info, verbose
* static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
*
* Step 2 [3rd party frameworks]:
*
* Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel:
*
* // #undef LOG_LEVEL_DEF // Undefine first only if needed
* #define LOG_LEVEL_DEF myLibLogLevel
*
* Define your logging level in your implementation file:
*
* // Log levels: off, error, warn, info, verbose
* static const DDLogLevel myLibLogLevel = DDLogLevelVerbose;
*
* Step 3:
* Replace your NSLog statements with DDLog statements according to the severity of the message.
*
* NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!");
*
* DDLog works exactly the same as NSLog.
* This means you can pass it multiple variables just like NSLog.
**/

#import <Foundation/Foundation.h>

// Disable legacy macros
#ifndef DD_LEGACY_MACROS
#define DD_LEGACY_MACROS 0
#endif

// Core
#import "DDLog.h"

// Main macros
#import "DDLogMacros.h"
#import "DDAssertMacros.h"

// Capture ASL
#import "DDASLLogCapture.h"

// Loggers
#import "DDTTYLogger.h"
#import "DDASLLogger.h"
#import "DDFileLogger.h"

// CLI
#if __has_include("CLIColor.h") && TARGET_OS_OSX
#import "CLIColor.h"
#endif
41 changes: 41 additions & 0 deletions Vendor/CocoaLumberjack/DDASLLogCapture.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Software License Agreement (BSD License)
//
// Copyright (c) 2010-2016, Deusty, LLC
// All rights reserved.
//
// Redistribution and use of this software 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.
//
// * Neither the name of Deusty nor the names of its contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission of Deusty, LLC.

#import "DDASLLogger.h"

@protocol DDLogger;

/**
* This class provides the ability to capture the ASL (Apple System Logs)
*/
@interface DDASLLogCapture : NSObject

/**
* Start capturing logs
*/
+ (void)start;

/**
* Stop capturing logs
*/
+ (void)stop;

/**
* The current capture level.
* @note Default log level: DDLogLevelVerbose (i.e. capture all ASL messages).
*/
@property (class) DDLogLevel captureLevel;

@end
Loading