Giter Club home page Giter Club logo

puree-ios's Introduction

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.

puree-ios's People

Contributors

slightair avatar vmfo22 avatar luissilvaos avatar udzura avatar giginet avatar

Watchers

Carabineiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.