Skip to content
This repository has been archived by the owner on Jan 25, 2018. It is now read-only.

Commit

Permalink
initial commit in new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
rustle committed Mar 14, 2012
0 parents commit 4ba42e6
Show file tree
Hide file tree
Showing 9 changed files with 1,256 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ESConsoleEntry.h
@@ -0,0 +1,32 @@
//
// ESConsoleEntry.h
//
// Copyright Doug Russell 2012. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import <Foundation/Foundation.h>

@interface ESConsoleEntry : NSObject

@property (nonatomic, retain) NSString *applicationIdentifier;
@property (nonatomic, retain) NSString *message;
@property (nonatomic, retain) NSDate *date;

@end

@interface ESConsoleEntry ()
@property (nonatomic, retain) NSString *shortMessage;
- (id)initWithDictionary:(NSDictionary *)dictionary;
@end
74 changes: 74 additions & 0 deletions ESConsoleEntry.m
@@ -0,0 +1,74 @@
//
// ESConsoleEntry.m
//
// Copyright Doug Russell 2012. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "ESConsoleEntry.h"
#import <asl.h>
#import "ARCLogic.h"

@implementation ESConsoleEntry
@synthesize message=_message;
@synthesize shortMessage=_shortMessage;
@synthesize applicationIdentifier=_applicationIdentifier;
@synthesize date=_date;

#pragma mark -

- (id)initWithDictionary:(NSDictionary *)dictionary
{
self = [super init];
if (self != nil)
{
if (dictionary == nil)
{
NO_ARC([self release];)
self = nil;
return nil;
}

self.message = [dictionary objectForKey:[NSString stringWithCString:ASL_KEY_MSG encoding:NSUTF8StringEncoding]];
if (self.message.length > 200)
self.shortMessage = [self.message substringToIndex:200];
else
self.shortMessage = self.message;
self.applicationIdentifier = [dictionary objectForKey:[NSString stringWithCString:ASL_KEY_FACILITY encoding:NSUTF8StringEncoding]];
if (self.applicationIdentifier == nil)
self.applicationIdentifier = [dictionary objectForKey:[NSString stringWithCString:ASL_KEY_SENDER encoding:NSUTF8StringEncoding]];
self.date = [NSDate dateWithTimeIntervalSince1970:[[dictionary objectForKey:[NSString stringWithCString:ASL_KEY_TIME encoding:NSUTF8StringEncoding]] doubleValue]];
}
return self;
}

- (void)dealloc
{
NO_ARC(
[_message release];
[_shortMessage release];
[_applicationIdentifier release];
[_date release];
[super dealloc];
)
}

#pragma mark -

- (NSString *)description
{
return [NSString stringWithFormat:@"Application Identifier: %@\n\nConsole Message: %@\n\nTime: %@", self.applicationIdentifier, self.message, self.date];
}

@end
41 changes: 41 additions & 0 deletions ESDebugConsole+iOS_GUI.h
@@ -0,0 +1,41 @@
//
// ESDebugConsole+iOS_GUI.h
//
// Copyright Doug Russell 2012. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "ESDebugConsole.h"

@interface ESDebugConsole (iOS_GUI)

/**
* Gesture recognizer will by default be a rotation gesture recognizer attached to the window
* If you set your own it's target must be [ESDebugConsole sharedDebugConsole] with action gestureRecognized:
*/
@property (nonatomic, retain) UIGestureRecognizer *gestureRecognizer;
/**
* Used by view controllers when displayed in UIPopoverController
*/
@property (nonatomic, assign) CGSize consoleSizeInPopover;

@end

@interface ESDebugConsole (iOS_GUI_Private)
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) UIPopoverController *popoverController;
@property (nonatomic, retain) UINavigationController *navigationController;
- (void)iOSInit;
- (void)iOSDealloc;
@end

0 comments on commit 4ba42e6

Please sign in to comment.