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 @@ -15,42 +15,13 @@ Object {
},
Object {
"@timestamp": "## @timestamp ##",
"message": "starting server :tada:",
"pid": "## PID ##",
"tags": Array [
"info",
"server",
],
"type": "log",
},
Object {
"@timestamp": "## @timestamp ##",
"message": "registering route handler for [/core]",
"pid": "## PID ##",
"tags": Array [
"info",
"http",
],
"type": "log",
},
Object {
"@timestamp": "## @timestamp ##",
"message": "starting http server [localhost:8274]",
"message": "Server running at http://localhost:8274",
"pid": "## PID ##",
"tags": Array [
"info",
"http",
"server",
],
"type": "log",
},
Object {
"@timestamp": "## @timestamp ##",
"message": "Server running at http://localhost:8274",
"pid": "## PID ##",
"tags": Array [
"listening",
"info",
],
"type": "log",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Object {

exports[`register route handler 1`] = `
Object {
"debug": Array [],
"error": Array [],
"fatal": Array [],
"info": Array [
"debug": Array [
Array [
"registering route handler for [/foo]",
],
],
"error": Array [],
"fatal": Array [],
"info": Array [],
"log": Array [],
"trace": Array [],
"warn": Array [],
Expand Down
8 changes: 6 additions & 2 deletions src/core/server/http/http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ export class HttpServer {
});
}

this.log.info(`starting http server [${config.host}:${config.port}]`);

await this.server.start();

this.log.info(
`Server running at ${this.server.info.uri}${config.rewriteBasePath ? config.basePath : ''}`,
// The "legacy" Kibana will output log records with `listening` tag even if `quiet` logging mode is enabled.
{ tags: ['listening'] }
);
}

public async stop() {
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/http_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class HttpService implements CoreService {
'Router will **not** be applied.'
);
} else {
this.log.info(`registering route handler for [${router.path}]`);
this.log.debug(`registering route handler for [${router.path}]`);
this.httpServer.registerRouter(router);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Server {
}

public async start() {
this.log.info('starting server :tada:');
this.log.debug('starting server :tada:');

const router = new Router('/core');
router.get({ path: '/', validate: false }, async (req, res) => res.ok({ version: '0.0.1' }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,25 @@ Array [
"message-8-with-message",
2012-02-01T11:22:33.044Z,
],
Array [
Array [
"info",
"context-9",
"sub-context-9",
],
"message-9-with-message",
2012-02-01T11:22:33.044Z,
],
Array [
Array [
"info",
"context-10",
"sub-context-10",
"tag1",
"tag2",
],
"message-10-with-message",
2012-02-01T11:22:33.044Z,
],
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ test('`append()` correctly pushes records to legacy platform.', () => {
message: 'message-8-with-message',
timestamp,
},
{
context: 'context-9.sub-context-9',
level: LogLevel.Info,
message: 'message-9-with-message',
timestamp,
meta: { someValue: 3 },
},
{
context: 'context-10.sub-context-10',
level: LogLevel.Info,
message: 'message-10-with-message',
timestamp,
meta: { tags: ['tag1', 'tag2'] },
},
];

const rawKbnServerMock = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ export class LegacyAppender implements DisposableAppender {
* write record to the configured destination.
* @param record `LogRecord` instance to forward to.
*/
public append(record: LogRecord) {
this.kbnServer.log(
[record.level.id.toLowerCase(), ...record.context.split('.')],
record.error || record.message,
record.timestamp
);
public append({ level, context, message, error, timestamp, meta = {} }: LogRecord) {
const tags = [level.id.toLowerCase(), ...context.split('.'), ...(meta.tags || [])];

this.kbnServer.log(tags, error || message, timestamp);
}

public async dispose() {
Expand Down
10 changes: 1 addition & 9 deletions src/server/kbn_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ export default class KbnServer {
* @return undefined
*/
async listen() {
const {
server,
config,
} = this;
const { server } = this;

await this.ready();
await fromNode(cb => server.start(cb));
Expand All @@ -151,11 +148,6 @@ export default class KbnServer {
process.send(['WORKER_LISTENING']);
}

server.log(['listening', 'info'], `Server running at ${server.info.uri}${
config.get('server.rewriteBasePath')
? config.get('server.basePath')
: ''
}`);
return server;
}

Expand Down