Skip to content

Commit f7ded73

Browse files
committed
chore(extension-logging): rename @log to @logInvocation
1 parent 9782097 commit f7ded73

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

extensions/logging/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ facilities:
4343

4444
```ts
4545
import {inject} from '@loopback/context';
46-
import {Logger, log} from '@loopback/extension-logging';
46+
import {Logger, logInvocation} from '@loopback/extension-logging';
4747
import {get, param} from '@loopback/rest';
4848

4949
class MyController {
@@ -54,7 +54,7 @@ class MyController {
5454
// http access is logged by a global interceptor
5555
@get('/greet/{name}')
5656
// log the `greet` method invocations
57-
@log()
57+
@logInvocation()
5858
greet(@param.path.string('name') name: string) {
5959
return `Hello, ${name}`;
6060
}
@@ -85,8 +85,8 @@ namespace below:
8585
- FLUENT_SENDER - A fluent sender
8686
- WINSTON_LOGGER - A winston logger
8787
- WINSTON_TRANSPORT_FLUENT - A fluent transport for winston
88-
- WINSTON_INTERCEPTOR - A local interceptor set by `@log` to log method
89-
invocations
88+
- WINSTON_INTERCEPTOR - A local interceptor set by `@logInvocation` to log
89+
method invocations
9090
- WINSTON_HTTP_ACCESS_LOGGER - A global interceptor that logs http access with
9191
[Morgan](https://github.com/expressjs/morgan) format
9292

extensions/logging/src/__tests__/accpetance/logging.interceptor.acceptance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '@loopback/testlab';
1414
import {format, transports} from 'winston';
1515
import {
16-
log,
16+
logInvocation,
1717
LoggingComponent,
1818
WinstonFormat,
1919
WinstonLogRecord,
@@ -29,7 +29,7 @@ describe('Logging interceptor', () => {
2929

3030
class MyController {
3131
@get('/greet/{name}')
32-
@log()
32+
@logInvocation()
3333
greet(@param.path.string('name') name: string) {
3434
return `Hello, ${name}`;
3535
}

extensions/logging/src/decorators/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// This file is licensed under the MIT License.
44
// License text available at https://opensource.org/licenses/MIT
55

6-
export * from './log.decorator';
6+
export * from './logging.decorator';

extensions/logging/src/decorators/log.decorator.ts renamed to extensions/logging/src/decorators/logging.decorator.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ import {intercept} from '@loopback/context';
77
import {LoggingBindings} from '../keys';
88

99
/**
10-
* @log decorator for method invocations.
10+
* @logInvocation decorator for method invocations.
1111
*
1212
* @example
1313
* ```ts
14-
* import {log} from '@loopback/extension-logging';
14+
* import {logInvocation} from '@loopback/extension-logging';
1515
*
1616
* export class HelloController {
17-
* @log()
17+
* @logInvocation()
1818
* hello(name: string) {
1919
* return `Hello, ${name}`;
2020
* }
2121
* }
2222
* ```
2323
*/
24-
export function log() {
24+
export function logInvocation() {
2525
// A shortcut to `@intercept` that invokes the winston interceptor that logs
2626
// method invocations
2727
return intercept(LoggingBindings.WINSTON_INVOCATION_LOGGER);

0 commit comments

Comments
 (0)