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K,MAAM;gBACP,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;oBACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;iBAC3B;gBACD,MAAM;YACV,KAAK,MAAM;gBACP,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;oBACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;iBAC3B;gBACD,MAAM;SACb;IACL,CAAC;IACL,kBAAC;AAAD,CA5FA,AA4FC,IAAA","file":"DebugLogger.js","sourcesContent":["import {Logger} from \"./Logger\";\nimport {QueryRunner} from \"../\";\nimport {PlatformTools} from \"../platform/PlatformTools\";\n\n/**\n * Performs logging of the events in TypeORM via debug library.\n */\nexport class DebugLogger implements Logger {\n private debug = PlatformTools.load(\"debug\");\n\n private debugQueryLog = this.debug(\"typeorm:query:log\");\n private debugQueryError = this.debug(\"typeorm:query:error\");\n private debugQuerySlow = this.debug(\"typeorm:query:slow\");\n private debugSchemaBuild = this.debug(\"typeorm:schema\");\n private debugMigration = this.debug(\"typeorm:migration\");\n \n private debugLog = this.debug(\"typeorm:log\");\n private debugInfo = this.debug(\"typeorm:info\");\n private debugWarn = this.debug(\"typeorm:warn\");\n \n /**\n * Logs query and parameters used in it.\n */\n logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner) {\n if (this.debugQueryLog.enabled) {\n this.debugQueryLog(PlatformTools.highlightSql(query) + \";\");\n if (parameters && parameters.length) {\n this.debugQueryLog(\"parameters:\", parameters);\n }\n }\n }\n \n /**\n * Logs query that failed.\n */\n logQueryError(error: string, query: string, parameters?: any[], queryRunner?: QueryRunner) {\n if (this.debugQueryError.enabled) {\n this.debugQueryError(PlatformTools.highlightSql(query) + \";\");\n if (parameters && parameters.length) {\n this.debugQueryError(\"parameters:\", parameters);\n }\n this.debugQueryError(\"error: \", error);\n }\n }\n \n /**\n * Logs query that is slow.\n */\n logQuerySlow(time: number, query: string, parameters?: any[], queryRunner?: QueryRunner) {\n if (this.debugQuerySlow.enabled) {\n this.debugQuerySlow(PlatformTools.highlightSql(query) + \";\");\n if (parameters && parameters.length) {\n this.debugQuerySlow(\"parameters:\", parameters);\n }\n this.debugQuerySlow(\"execution time:\", time);\n }\n }\n \n /**\n * Logs events from the schema build process.\n */\n logSchemaBuild(message: string, queryRunner?: QueryRunner) {\n if (this.debugSchemaBuild.enabled) {\n this.debugSchemaBuild(message);\n }\n }\n \n /**\n * Logs events from the migration run process.\n */\n logMigration(message: string, queryRunner?: QueryRunner) {\n if (this.debugMigration.enabled) {\n this.debugMigration(message);\n }\n }\n \n /**\n * Perform logging using given logger.\n * Log has its own level and message.\n */\n log(level: \"log\" | \"info\" | \"warn\", message: any, queryRunner?: QueryRunner) {\n switch (level) {\n case \"log\":\n if (this.debugLog.enabled) {\n this.debugLog(message);\n }\n break;\n case \"info\":\n if (this.debugInfo.enabled) {\n this.debugInfo(message);\n }\n break;\n case \"warn\":\n if (this.debugWarn.enabled) {\n this.debugWarn(message);\n }\n break;\n }\n }\n}\n"],"sourceRoot":".."}
|