All files log.js

0% Statements 0/21
100% Branches 0/0
0% Functions 0/6
0% Lines 0/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36                                                                       
"use strict";
/* eslint-disable no-console */
/*
 * @Author: lijianzhang
 * @Date: 2018-03-31 21:38:41
 * @Last Modified by: lijianzhang
 * @Last Modified time: 2018-08-29 23:16:36
 * @flow
 */
exports.__esModule = true;
var event_1 = require("./event");
function useLog() {
    var unAction = event_1["default"].on('action', function (name) {
        console.time(name);
        console.group('%c %s %c %s', 'color: #03A9F4;', 'action', 'color: #666', name);
    });
    var unEndAction = event_1["default"].on('endAction', function (name) {
        console.timeEnd(name);
        console.groupEnd();
    });
    var unObserver = event_1["default"].on('Observer', function (name) {
        console.log('%c %s %c %s', 'color: #2196F3;', 'Observer: ', 'color: #666', name);
    });
    var unSet = event_1["default"].on('set', function (_a) {
        var target = _a.target, key = _a.key, value = _a.value;
        console.log('%c set: %o %c %s %c newValue %o', 'color: #ff4a4e;', target, 'color: #009688;', key, 'color: #03A9F4;', value); //eslint-disable-line
    });
    return function () {
        unAction();
        unEndAction();
        unObserver();
        unSet();
    };
}
exports["default"] = useLog;