Skip to content

Commit 3c53190

Browse files
fix(partition-key.decorator): use logger instead of console
1 parent c7009ef commit 3c53190

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/decorator/impl/key/partition-key.decorator.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
/**
22
* @module decorators
33
*/
4+
import { createOptModelLogger } from '../../../logger/logger'
45
import { PropertyMetadata } from '../../metadata/property-metadata.model'
56
import { initOrUpdateProperty } from '../property/init-or-update-property.function'
67
import { KEY_PROPERTY } from '../property/key-property.const'
78

9+
const logger = createOptModelLogger('@PartitionKey')
10+
811
export function PartitionKey(): PropertyDecorator {
912
return (target: any, propertyKey: string | symbol) => {
1013
if (typeof propertyKey === 'string') {
@@ -14,9 +17,11 @@ export function PartitionKey(): PropertyDecorator {
1417
const existingPartitionKeys = properties.filter(property => property.key && property.key.type === 'HASH')
1518
if (existingPartitionKeys.length) {
1619
if (properties.find(property => property.name === propertyKey)) {
17-
// just ignore this and go on, somehow the partition key gets defined
18-
// tslint:disable-next-line:no-console
19-
console.warn(`this is the second execution to define the partitionKey for property ${propertyKey}`)
20+
// just ignore this and go on, somehow the partition key gets defined two times
21+
logger.warn(
22+
`this is the second execution to define the partitionKey for property ${propertyKey}`,
23+
target.constructor,
24+
)
2025
} else {
2126
throw new Error(
2227
'only one partition key is allowed per model, if you want to define key for indexes use one of these decorators: ' +

0 commit comments

Comments
 (0)