Skip to content

feat(logger): log internal server errors #429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 1, 2021
Merged

feat(logger): log internal server errors #429

merged 2 commits into from
Feb 1, 2021

Conversation

pirklmar
Copy link

@pirklmar pirklmar commented Feb 1, 2021

Description

Adds logging of all errors those are presented as InternalServerError. The motivation is to have a last fallback for logging errors those come unexpectedly from our business logic

@pirklmar pirklmar requested a review from a team as a code owner February 1, 2021 14:43
Copy link
Contributor

@sleistner sleistner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make the logger a configurable property?
E.g.

type JSONType = { [key: string]: unknown };
type LoggerArgument = (JSONType | string | unknown)[];

interface Logger {
    info(...args: LoggerArgument): void;
    warn(...args: LoggerArgument): void;
    error(...args: LoggerArgument): void;
    debug(...args: LoggerArgument): void;
}

//config.ts
class Config {
    public logger: Logger = console;
}

export const config = new Config();

//handler

@APIGatewayProxyHandler({logger: myCustomLogger})
function handler {}

@sleistner sleistner merged commit a16c462 into master Feb 1, 2021
@sleistner sleistner deleted the feat/logger branch February 1, 2021 15:15
@sleistner
Copy link
Contributor

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants