TypeDORM implements debug based logger which can be enabled by setting DEBUG
environment variable to typedorm:*
.
These are the current available debug namespaces, that TypeDORM understands.
typedorm:transform:log
- basic transforms, logs before and after statestypedorm:transform:batch:log
- logs batch transformstypedorm:transform:transaction:log
- logs transaction transformstypedorm:transform:*
- glob pattern that enables all kind of transform logstypedorm:info:log
- logs all basic info, like hints or just static informationtypedorm:warn:log
- logs all warnings that should be resolvedtypedorm:error:log
- logs all errors that may have happen during the processing of a requesttypedorm:stats:log
- logs all statistics, like consumed capacity for a request,- this relates directly to what the returnConsumedCapacity is set to, if
returnConsumedCapacity
is set toNONE
, no stats log will be visible.
- this relates directly to what the returnConsumedCapacity is set to, if
typedorm:*
- glob pattern that enables all logs
All Transform logs can be enabled by setting DEBUG
environment variable to one of the above debug namespaces.
All the logs uses syntax highlighting (using chalk)
For example, executing EntityManager.update
operation with transformed log enabled, this will be printed to console.
typedorm:transform:log d2f20c3e-2ceb-4e7b-b60c-3484016cd950 UPDATE user Before:
Primary key:
{
"id": "1"
}
Body:
{
"name": "user",
"status": "active"
}
Options:
{}
+0ms
typedorm:transform:log d2f20c3e-2ceb-4e7b-b60c-3484016cd950 UPDATE user After:
Body:
{
"TableName": "test-table",
"Key": {
"PK": "USER#1",
"SK": "USER#1"
},
"UpdateExpression": "SET #attr0 = :val0, #attr1 = :val1, #attr2 = :val2, #attr3 = :val3",
"ReturnValues": "ALL_NEW",
"ExpressionAttributeNames": {
"#attr0": "name",
"#attr1": "status",
"#attr2": "GSI1SK",
"#attr3": "GSI1PK"
},
"ExpressionAttributeValues": {
":val0": "user",
":val1": "active",
":val2": "USER#user",
":val3": "USER#STATUS#active"
}
}
+0ms
typedorm:transform:log d2f20c3e-2ceb-4e7b-b60c-3484016cd950 RESPONSE user Before:
Body:
{
"PK": "USER#1",
"SK": "USER#1",
"GSI1PK": "USER#STATUS#active",
"GSI1SK": "USER#Me",
"id": "1",
"name": "user",
"status": "active"
}
+0ms
typedorm:transform:log d2f20c3e-2ceb-4e7b-b60c-3484016cd950 RESPONSE user After:
Body:
{
"id": "1",
"name": "user",
"status": "active"
}
From 1.13.x, With each each operation, there is now a capability to provide a unique request id (Check Api for more details), which can be used to track lifecycle of entire request as it
gets processed.
PS. this logs will only appear if the DEBUG
env is set:
i.e, here is how log trace of a update request will look like with custom requestId
and typedorm:*
debug namespace.