Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,28 @@ import {readLog} from '../fixtures/fluentd.docker';

Comment thread
raymondfeng marked this conversation as resolved.
const sleep = promisify(setTimeout);

describe('LoggingComponent', () => {
describe('LoggingComponent', function() {
let app: Application;

// eslint-disable-next-line no-invalid-this
this.timeout(10000);

beforeEach(givenAppWithCustomConfig);

/* eslint-disable no-invalid-this */
it('binds a fluent sender', async function() {
if (process.env.FLUENTD_SERVICE_PORT_TCP == null) return this.skip();
const sender = await app.get(LoggingBindings.FLUENT_SENDER);
sender.emit({greeting: 'Hello, LoopBack!'});
await sleep(100);
await sleep(500);
await expectLogsToMatch(/LoopBack\s+\{"greeting"\:"Hello, LoopBack!"\}/);
});

it('binds a winston transport for fluent', async function() {
if (process.env.FLUENTD_SERVICE_PORT_TCP == null) return this.skip();
const logger = await app.get(LoggingBindings.WINSTON_LOGGER);
logger.log('info', 'Hello, LoopBack!');
await sleep(100);
await sleep(500);
await expectLogsToMatch(
/LoopBack\s+\{"level"\:"info","message":"Hello, LoopBack!"\}/,
);
Expand Down
2 changes: 1 addition & 1 deletion extensions/logging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This module contains a component provides logging facilities based on
[Winston](https://github.com/winstonjs/winston) and
[Fluentd](https://github.com/fluent/fluent-logger-node).

## Stability: :warning:Experimental:warning:
## Stability: ⚠️Experimental⚠️

> Experimental packages provide early access to advanced or experimental
> functionality to get community feedback. Such modules are published to npm
Expand Down
3 changes: 2 additions & 1 deletion extensions/logging/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@loopback/extension-logging",
"version": "0.0.1",
"description": "LoopBack Logging for Fluentd",
"description": "LoopBack Logging for Winston and Fluentd",
"engines": {
"node": ">=8.9"
},
Expand Down Expand Up @@ -36,6 +36,7 @@
"LoopBack",
"Cloud Native",
"Fluentd",
"Winston",
"Logging"
],
"files": [
Expand Down