Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

sgr/Yosaku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yosaku

CI Status Version License Platform

Yosaku is a log viewer for Cocoa Touch. It depends on CocoaLumberjack.

iPhone portrait screenshot iPhone landspace screenshot

Usage

Initializing YSLogger

Yosaku provides YSLogger class as a DDLogger. In the following example, YSLogger is initialized as a property of your application delegate.

#import <YSLogger.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
    dateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"JST"];
    dateFormatter.dateFormat = @"yyyy/MM/dd HH:mm:ss.SSS";

    _logger = [[YSLogger alloc] initWithCapacity:100 dateFormatter:dateFormatter];
    _logger.updateIntervalSec = 1.5;
    [DDLog addLogger:_logger];

    return YES;
}

Displaying log messages

Yosaku uses UITableView for displaying log records. You create an empty UITableView and set it to YSLogger. In the following example, UITableView is set to app.logger in your view controller's viewDidLoad method.

- (void)viewDidLoad
{
    [super viewDidLoad];

    // _app.logger is a YSLogger
    _app = [UIApplication sharedApplication].delegate;
    _app.logger.tableView = _logTableView; // YSLogger set myself to tableView's data source and delegate
    [_app.logger viewDidLoad];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [_app.logger viewWillDisappear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [_app.logger viewDidAppear:animated];
}

You must call viewDidLoad, viewWillDisappear, and viewDidAppear in your view controller's same name methods for synchronizing YSLogger's life cycle with your view controller's it.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • XCode 5.1 or later
  • iOS 7 or later

Installation

Yosaku is available through CocoaPods. To install it, simply add the following line to your Podfile:

    pod 'Yosaku', '~> 0.2.0' # for CocoaLumberjack 2.0.x
    pod 'Yosaku', '~> 0.1.1' # for CocoaLumberjack 1.9.x

Author

Shigeru Fujiwara

License

Yosaku is available under the MIT license. See the LICENSE file for more info.

About

A log viewer for Cocoa Touch.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors