Puree is a log collector which provides some features like below

Related tags

Logging puree-ios
Overview

Puree

Version License Platform Travis

Description

Puree is a log collector which provides some features like below

  • Filtering: Enable to interrupt process before sending log. You can add common params to logs, or the sampling of logs.
  • Buffering: Store logs to buffer until log was sent.
  • Batching: Enable to send logs by 1 request.
  • Retrying: Retry to send logs after backoff time automatically if sending logs fails.

Puree helps you unify your logging infrastructure.

Usage

Configure Logger

// Swift

let configuration = PURLoggerConfiguration.default()
configuration.filterSettings = [
    PURFilterSetting(filter: ActivityFilter.self, tagPattern: "activity.**"),
    // filter settings ...
]
configuration.outputSettings = [
    PUROutputSetting(output: ConsoleOutput.self,   tagPattern: "activity.**"),
    PUROutputSetting(output: ConsoleOutput.self,   tagPattern: "pv.**"),
    PUROutputSetting(output: LogServerOutput.self, tagPattern: "pv.**", settings:[PURBufferedOutputSettingsFlushIntervalKey: 10]),
    // output settings ...
]

let logger = PURLogger(configuration: configuration)
// Objective-C

PURLoggerConfiguration *configuration = [PURLoggerConfiguration defaultConfiguration];
configuration.filterSettings = @[
    [[PURFilterSetting alloc] initWithFilter:[ActivityFilter class]
                                  tagPattern:@"activity.**"],
    // filter settings ...
];
configuration.outputSettings = @[
    [[PUROutputSetting alloc] initWithOutput:[ConsoleOutput class]
                                  tagPattern:@"activity.**"],
    [[PUROutputSetting alloc] initWithOutput:[ConsoleOutput class]
                                  tagPattern:@"pv.**"],
    [[PUROutputSetting alloc] initWithOutput:[LogServerOutput class]
                                  tagPattern:@"pv.**"
                                  settings:@{PURBufferedOutputSettingsFlushIntervalKey: @10}],
    // output settings ...
];

PURLogger *logger = [[PURLogger alloc] initWithConfiguration:configuration];

Expected result

tag name                 [ Filter Plugin ]  -> [ Output Plugin ]
-----------------------------------------------------------------
activity.recipe.view  -> [ ActivityFilter ] -> [ ConsoleOutput ]
activity.bargain.view -> [ ActivityFilter ] -> [ ConsoleOutput ]
pv.recipe_detail      -> ( no filter )      -> [ ConsoleOutput ], [ LogServerOutput(FlushInterval:10sec) ]
event.special         -> ( no filter )      -> ( no output )

Post log

Post log object(anyObject) in an arbitrary timing.

// Swift

logger.post(["recipe_id": "123"], tag: "pv.recipe_detail")
// Objective-C

[logger postLog:@{@"recipe_id": @"123"} tag: @"pv.recipe_detail"]

Plugins

You can create plugins. See Create Plugins

Tag system

Tag

Tag is consisted of multiple term split by .. For example activity.recipe.view, pv.recipe_detail. You can specify tag to log freely.

Pattern

Filter, Output and BufferedOutput plugins is applied to tag matched logs. You can specify tag pattern for plugin reaction rules.

Simple pattern

Pattern aaa.bbb match tag aaa.bbb, not match tag aaa.ccc (Perfect matching).

Wildcard

Pattern aaa.* match tags aaa.bbb, aaa.ccc. Not match tags aaa, aaa.bbb.ccc (single term).

Pattern aaa.** match tags aaa, aaa.bbb and aaa.bbb.ccc. Not match tag xxx.yyy.zzz (zero or more terms).

Installation

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

pod "Puree"

Author

Tomohiro Moro, [email protected]

License

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

Comments
  • Modify pessimistic version for YapDatabase

    Modify pessimistic version for YapDatabase

    YapDatabase 2.9.3 is already released. However, Puree uses the older one.

    To suppress the warning, I'd like to use newest. So I modified dependencies version.

    @slightair Please review it :pray:

    opened by giginet 5
  • Performance Improvements

    Performance Improvements

    DBの読み書きがメインスレッドで実行されておりUIアップデート処理がブロックされていたので、非同期のメソッドに移行しました。

    DB I/O is performed on the main thread which blocks UI updates, so change to use asynchronous methods.

    opened by chuganzy 5
  • 内部DBが肥大化する&パフォーマンスが劣化する

    内部DBが肥大化する&パフォーマンスが劣化する

    こんにちは pureeを使用しているプロジェクトで報告があったのですが、導入後アプリ起動のパフォーマンスがアプリを使っていくたびに劣化するとの報告がありました。

    調べて頂いたら

    ・logデータ1万件、logDBサイズ10MB、log初期化時間1.5秒 ・logデータ2万件、logDBサイズ20MB、log初期化時間3.0秒 ※logDB : Library/Caches/com.cookpad.PureeData.default/logs.db と肥大化しているようで、また起動時にイベントを投げるところがあり、そこで遅くなっている模様でした。

    パフォーマンスの劣化の原因としては下記のPRにあるようにDBの書き込みをメインスレッドで行っており、DBのサイズの肥大化に伴い劣化しているのかなと思われます。 #6

    こちら何かしら、回避策はありますでしょうか?

    opened by nyankichi820 4
  • Make buffer list in PURBufferedOutput Thread Safe

    Make buffer list in PURBufferedOutput Thread Safe

    Hello.

    When I handled PURBufferdOutput with multiple threads, I encountered the following crash.

    Fatal Exception: NSInvalidArgumentException
    0  CoreFoundation                 0x183a57d38 __exceptionPreprocess
    1  libobjc.A.dylib                0x182f6c528 objc_exception_throw
    2  CoreFoundation                 0x1839f0c44 _CFArgv
    3  CoreFoundation                 0x183923e94 -[__NSPlaceholderArray initWithObjects:count:]
    4  CoreFoundation                 0x18392fd5c +[NSArray arrayWithObjects:count:]
    5  CoreFoundation                 0x183943b88 -[NSArray objectsAtIndexes:]
    6  AppName                        0x10089ebac -[PURBufferedOutput flush] (PURBufferedOutput.m:157)
    7  AppName                        0x10089e594 __26-[PURBufferedOutput start]_block_invoke (PURBufferedOutput.m:93)
    8  libdispatch.dylib              0x1833dd088 _dispatch_call_block_and_release
    9  libdispatch.dylib              0x1833dd048 _dispatch_client_callout
    10 libdispatch.dylib              0x18341ddfc _dispatch_main_queue_callback_4CF$VARIANT$armv81
    11 CoreFoundation                 0x1839fff20 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
    12 CoreFoundation                 0x1839fdafc __CFRunLoopRun
    13 CoreFoundation                 0x18391e2d8 CFRunLoopRunSpecific
    14 GraphicsServices               0x1857aff84 GSEventRunModal
    15 UIKit                          0x18ceca880 UIApplicationMain
    16 AppName                        0x100ac05b4 main (main.m:22)
    17 libdyld.dylib                  0x18344256c start
    

    So I made Thread Safe PURBufferCollection Class. PURBufferedOutput can avoid crashing by handling buffer logs via this class.

    Please review my code and release new version if possible. Thanks.

    opened by atsushisakai-gh 3
  • Replace import statement " to double-quotes">

    Replace import statement "< >" to double-quotes

    In XCode 7(7A220), this statement causes compile error;

    Pods/Puree/Pod/Classes/PURLogStore.m:9:9: 'YapDatabase.h' file not found with <angled> include; use "quotes" instead
    
    opened by ainoya 2
Releases(2.0.1)
  • 2.0.1(Nov 2, 2016)

  • 2.0.0(Oct 9, 2016)

    • Asynchronous DB readwrite in BufferedOutput, LogStore (#6, #12). Thank you @chuganzy
    • Rewrite test code with Swift3 (#12, #14)
    • Change API for Swift3 naming rule (#12, #14)
    • Update dependencies (#12)
    Source code(tar.gz)
    Source code(zip)
Owner
Cookpad
Cookpad
Simply, Logify provides instant colorful logs to improve log tracking and bug tracing

Logify Simply, Logify provides instant colorful logs to improve log tracking and bug tracing. Why I need to use Logify? As discussed before in a lot o

Furkan KAPLAN 13 Dec 28, 2022
📱💬🚦 TinyConsole is a micro-console that can help you log and display information inside an iOS application, where having a connection to a development computer is not possible.

TinyConsole TinyConsole is a tiny log console to display information while using your iOS app and written in Swift. Usage Wrap your Main ViewControlle

Devran Cosmo Uenal 2k Jan 3, 2023
Gedatsu provide readable format about AutoLayout error console log

Gedatsu Gedatsu provide readable format about AutoLayout error console log Abstract At runtime Gedatsu hooks console log and formats it to human reada

bannzai 520 Jan 6, 2023
Customizable Console UI overlay with debug log on top of your iOS App

AEConsole Customizable Console UI overlay with debug log on top of your iOS App AEConsole is built on top of AELog, so you should probably see that fi

Marko Tadić 142 Dec 21, 2022
🍯 Awesome log aggregator for iOS

?? Awesome log aggregator for iOS

Cookpad 204 Oct 24, 2022
Gedatsu provide readable format about AutoLayout error console log

Gedatsu Gedatsu provide readable format about AutoLayout error console log Abstract At runtime Gedatsu hooks console log and formats it to human reada

bannzai 475 Jun 24, 2021
A Swift-based API for reading from & writing to the Apple System Log (more commonly known somewhat inaccurately as "the console")

CleanroomASL Notice: CleanroomASL is no longer supported The Apple System Log facility has been deprecated by Apple. As a result, we've deprecated Cle

Gilt Tech 62 Jan 29, 2022
Log every incoming notification to view them again later, also includes attachments and advanced settings to configure

Vē Natively integrated notification logger Installation Add this repository to your package manager

alexandra 43 Dec 25, 2022
A custom logger implementation and Task Local helper for swift-log

LGNLog A custom logger implementation and TaskLocal helper for Swift-Log. Why and how This package provides two and a half things (and a small bonus):

17:11 Games 0 Oct 26, 2021
Automate box any value! Print log without any format control symbol! Change debug habit thoroughly!

LxDBAnything Automate box any value! Print log without any format control symbol! Change debug habit thoroughly! Installation You only need drag LxD

DeveloperLx 433 Sep 7, 2022
A log should tell a story, not drown the reader in irrelevance.

StoryTeller A log should tell a story, not drown the reader in irrelevance Story Teller is an advanced logging framework that takes an entirely differ

Derek Clarkson 10 Sep 20, 2019
A logging backend for swift-log that sends logging messages to Logstash (eg. the ELK stack)

LoggingELK LoggingELK is a logging backend library for Apple's swift-log The LoggingELK library provides a logging backend for Apple's apple/swift-log

null 17 Nov 15, 2022
Log messages to text files and share them by email or other way.

LogToFiles How to log messages to text files and share them by email or share center. 1 - Add the Log.swift file to your App 2 - Just log the messages

Miguel Chaves 0 Jan 9, 2022
100 Days of SwiftUI log

100DaysOfSwiftUI 100 Days of SwiftUI log Table of Contents Day 1: variables, constants, strings, and numbers Day 1 Variables store values and can be c

Maegan Wilson 3 Oct 18, 2022
Simple Design for Swift bridge with Javascript. Also can get javascript console.log.

SDBridgeOC is here. If your h5 partner confused about how to deal with iOS and Android. This Demo maybe help. YouTube video is here. bilibili Video is

null 20 Dec 28, 2022
CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant

CleanroomLogger CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant. The API provided by Cleanro

null 1.3k Dec 8, 2022
A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below.

MCScratchImageView GIF Showcase Requirments iOS 8.0+ Xcode 7.2+ Swift 4.0 Installation CocoaPods pod "MCScratchImageView" Manually Just drag MCScratch

Jaylen Bian 359 Dec 17, 2022
📸 iMessage-like, Image Picker Controller Provides custom features.

RAImagePicker Description RAImagePicker is a protocol-oriented framework that provides custom features from the built-in Image Picker Edit. Overview O

Rashed Al-Lahaseh 14 Aug 18, 2022