{"size": 1531, "ext": "js", "max_stars_repo_path": "dist/log-method.js", "max_stars_repo_name": "kaushiksamanta/ts-chalk-logger", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/log-method.js", "max_issues_repo_name": "kaushiksamanta/ts-chalk-logger", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/log-method.js", "max_forks_repo_name": "kaushiksamanta/ts-chalk-logger", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 49.3870967742, "max_line_length": 182, "alphanum_fraction": 0.6433703462}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var log_wrapper_1 = require("./log-wrapper");
var chalk_1 = __importDefault(require("chalk"));
/**
 * Log to console name of method, value and type of each parameter and returned value with its type
 * @param target
 * @param {string} propertyName
 * @param {PropertyDescriptor} descriptor
 */
function logMethod(target, propertyName, descriptor) {
    var originalMethod = descriptor.value;
    descriptor.value = function () {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        var className = target.constructor.name;
        log_wrapper_1.logger(className, chalk_1.default.blueBright('======================= LOG METHOD ================================='));
        log_wrapper_1.logger(className, chalk_1.default.green("Method name -->") + " " + chalk_1.default.yellow(propertyName));
        log_wrapper_1.logger(className, chalk_1.default.green("Method arguments -->") + " " + chalk_1.default.yellow(args.map(function (a) { return JSON.stringify(a); }).join(',')));
        var result = originalMethod.apply(this, args);
        log_wrapper_1.logger(className, chalk_1.default.green("Method result -->") + " " + chalk_1.default.yellow(JSON.stringify(result)));
        return result;
    };
}
exports.logMethod = logMethod;
