"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogLevel = exports.LoggingService = exports.logOther = exports.logConnection = exports.logStartup = exports.logDatabase = exports.logAuth = exports.logWarning = exports.logError = exports.logRequest = void 0;
const LoggingService_1 = require("./LoggingService");
Object.defineProperty(exports, "LoggingService", { enumerable: true, get: function () { return LoggingService_1.LoggingService; } });
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return LoggingService_1.LogLevel; } });
// Singleton instance
const logger = LoggingService_1.LoggingService.getInstance();
// Convenience functions for each log level
const logRequest = (message, req, res, metadata) => {
    logger.log(LoggingService_1.LogLevel.REQUEST, message, metadata, req, res);
};
exports.logRequest = logRequest;
const logError = (message, error, req, res) => {
    const metadata = error ? {
        name: error.name,
        message: error.message,
        stack: error.stack
    } : undefined;
    logger.log(LoggingService_1.LogLevel.ERROR, message, metadata, req, res);
};
exports.logError = logError;
const logWarning = (message, metadata, req, res) => {
    logger.log(LoggingService_1.LogLevel.WARNING, message, metadata, req, res);
};
exports.logWarning = logWarning;
const logAuth = (message, userId, metadata, req, res) => {
    const authMetadata = {
        userId,
        ...metadata
    };
    logger.log(LoggingService_1.LogLevel.AUTH, message, authMetadata, req, res);
};
exports.logAuth = logAuth;
const logDatabase = (message, query, executionTime, metadata) => {
    const dbMetadata = {
        query: query ? query.substring(0, 200) : undefined,
        executionTime,
        ...metadata
    };
    logger.log(LoggingService_1.LogLevel.DATABASE, message, dbMetadata);
};
exports.logDatabase = logDatabase;
const logStartup = (message, metadata) => {
    logger.log(LoggingService_1.LogLevel.STARTUP, message, metadata);
};
exports.logStartup = logStartup;
const logConnection = (message, type, status, metadata) => {
    const connectionMetadata = {
        connectionType: type,
        status,
        ...metadata
    };
    logger.log(LoggingService_1.LogLevel.CONNECTION, message, connectionMetadata);
};
exports.logConnection = logConnection;
const logOther = (message, metadata, req, res) => {
    logger.log(LoggingService_1.LogLevel.OTHER, message, metadata, req, res);
};
exports.logOther = logOther;
exports.default = logger;
//# sourceMappingURL=Logger.js.map