-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(grpc-sdk): add support for logging to Grafana Loki (#249)
- Loading branch information
1 parent
bfee09f
commit 422b03e
Showing
6 changed files
with
186 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,19 @@ | ||
import expressWinston from 'express-winston'; | ||
import winston from 'winston'; | ||
|
||
export class ConduitLogger { | ||
get middleware() { | ||
return expressWinston.logger({ | ||
transports: [new winston.transports.Console()], | ||
format: winston.format.combine(winston.format.colorize(), winston.format.cli()), | ||
meta: false, | ||
msg: 'HTTP {{req.method}} {{req.url}}', | ||
expressFormat: true, | ||
colorize: false, | ||
}); | ||
} | ||
export function createRouteMiddleware(winstonInstance: winston.Logger) { | ||
return expressWinston.logger({ | ||
winstonInstance, | ||
meta: true, | ||
msg: 'HTTP {{req.method}} {{req.url}}', | ||
expressFormat: true, | ||
colorize: false, | ||
}); | ||
} | ||
|
||
get errorLogger() { | ||
return expressWinston.errorLogger({ | ||
transports: [new winston.transports.Console()], | ||
format: winston.format.combine(winston.format.prettyPrint({ colorize: true })), | ||
meta: false, | ||
}); | ||
} | ||
export function errorLogger(winstonInstance: winston.Logger) { | ||
return expressWinston.errorLogger({ | ||
winstonInstance, | ||
meta: true, | ||
}); | ||
} |
Oops, something went wrong.