"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.verboseIsImplied = exports.setLogLevel = void 0;
var crashMessage_1 = require("./crashMessage");
var pino_1 = require("./pino");
var pkg = require('../../package.json');
var logContext = "pact-core@" + pkg.version;
var currentLogLevel = 'info';
var logger = pino_1.createLogger(currentLogLevel);
var setLogLevel = function (level) {
    if (level === void 0) { level = 'info'; }
    currentLogLevel = level;
    logger = pino_1.createLogger(currentLogLevel);
};
exports.setLogLevel = setLogLevel;
var verboseIsImplied = function () {
    return currentLogLevel === 'trace' || currentLogLevel === 'debug';
};
exports.verboseIsImplied = verboseIsImplied;
var addContext = function (context, message) {
    return context + ": " + message;
};
exports.default = {
    pactCrash: function (message, context) {
        if (context === void 0) { context = logContext; }
        return logger.error(addContext(context, crashMessage_1.pactCrashMessage(message)));
    },
    error: function (message, context) {
        if (context === void 0) { context = logContext; }
        return logger.error(addContext(context, message));
    },
    warn: function (message, context) {
        if (context === void 0) { context = logContext; }
        return logger.warn(addContext(context, message));
    },
    info: function (message, context) {
        if (context === void 0) { context = logContext; }
        return logger.info(addContext(context, message));
    },
    debug: function (message, context) {
        if (context === void 0) { context = logContext; }
        return logger.debug(addContext(context, message));
    },
    trace: function (message, context) {
        if (context === void 0) { context = logContext; }
        return logger.trace(addContext(context, message));
    },
};
//# sourceMappingURL=index.js.map