https://orkhan.gitbook.io/typeorm/docs/logging
{
name: "mysql",
type: "mysql",
host: "localhost",
port: 3306,
username: "test",
password: "test",
database: "test",
...
logging: true
}
You can enable logging of all queries and errors by simply setting
logging: true
in data source options.
{
host: "localhost",
...
logging: ["error"]
}
You can enable different types of logging in data source options:
query
- logs all queries.error
- logs all failed queries and errors.schema
- logs the schema build process.warn
- logs internal orm warnings.info
- logs internal orm informative messages.log
- logs internal orm log messages.
https://github.com/typeorm/typeorm/blob/master/src/logger/Logger.ts
export type LogLevel =
| "query"
| "schema"
| "error"
| "warn"
| "info"
| "log"
| "migration"
export type LogMessageType =
| "log"
| "info"
| "warn"
| "error"
| "query"
| "query-error"
| "query-slow"
| "schema-build"
| "migration"
https://github.com/typeorm/typeorm/blob/master/src/logger/AbstractLogger.ts#L233
query-slow
LogMessageType은 항상 출력됩니다.
...
case "query-slow":
return true
...
advanced-console
: defaultsimple-console
file
debug