Logidze v0.8.0 Release Notes

Release Date: 2018-10-01 // over 5 years ago
  • ๐Ÿ”‹ Features

    Added ability to specify the debounce time to avoid spamming logs creation.

    ๐Ÿ‘€ See PR #87.

    Usage:

    # 5000msrails generate logidze:model story --debounce\_time=5000
    

    ๐Ÿ‘€ You see the following in generated migration

    CREATE TRIGGER logidze\_on\_stories BEFORE UPDATE OR INSERT ON stories FOR EACH ROW WHEN (coalesce(#{current\_setting('logidze.disabled')}, '') \<\> 'on') EXECUTE PROCEDURE logidze\_logger(null, 'updated\_at', null, 5000);
    

    โฌ†๏ธ How to upgrade.

    โšก๏ธ Please run rails generate logidze:install --update to regenerate stored functions.

    โœ… This feature checks if several logs came in within a debounce time period then only keep the latest one
    ๐Ÿ”€ by merging the latest in previous others.

    The concept is similar to https://underscorejs.org/#debounce

    without debounce_time

    { "h": [{ "c": { "content": "Content 1" }, "v": 1, "ts": 0 }, { "c": { "content": "content 2", "active": true }, "v": 2, "ts": 100 }, { "c": { "content": "content 3", }, "v": 3, "ts": 101 }], "v": 3}
    

    with debounce_time of 10ms

    { "h": [{ "c": { "content": "Content 1" }, "v": 1, "ts": 0 }, { "c": { "content": "content 3", "active": true }, "v": 2, "ts": 101 }], "v": 3}