"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * @module logger
 * @preferred
 *
 * Logger used in dynamo-easy
 */
const dynamo_easy_config_1 = require("../config/dynamo-easy-config");
const log_level_type_1 = require("./log-level.type");
/**
 * @hidden
 */
function getLogFn(className, modelConstructor, level) {
    return (message, data) => {
        dynamo_easy_config_1.dynamoEasyConfig.logReceiver({
            className,
            modelConstructor,
            level,
            message,
            data,
            timestamp: Date.now(),
        });
    };
}
/**
 * @hidden
 */
function createLogger(className, modelConstructor) {
    return {
        warn: getLogFn(className, modelConstructor.name, log_level_type_1.LogLevel.WARNING),
        info: getLogFn(className, modelConstructor.name, log_level_type_1.LogLevel.INFO),
        debug: getLogFn(className, modelConstructor.name, log_level_type_1.LogLevel.DEBUG),
    };
}
exports.createLogger = createLogger;
//# sourceMappingURL=logger.js.map