Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Update typescript-logging to use new formatter #13

Open
timburke opened this issue Dec 14, 2018 · 0 comments
Open

Update typescript-logging to use new formatter #13

timburke opened this issue Dec 14, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@timburke
Copy link
Member

timburke commented Dec 14, 2018

The configuration in config.ts should be:

import {Category,CategoryServiceFactory,
    CategoryConfiguration,LogLevel,CategoryLogFormat, CategoryLogMessage, MessageFormatUtils} from "typescript-logging";
 
// Optionally change default settings, in this example set default logging to Info.
// Without changing configuration, categories will log to Error.

let categoryConfig = new CategoryConfiguration(LogLevel.Info,
    undefined, new CategoryLogFormat(undefined, false, true));

categoryConfig.formatterLogMessage = (msg: CategoryLogMessage) => {
    return MessageFormatUtils.renderDefaultMessage(msg, false)
};

CategoryServiceFactory.setDefaultConfiguration(categoryConfig);

This will ensure that the log message does not have a duplicate stack frame and a duplicate timestamp, which interferes with the sentry event grouping causing events to show up as distinct rather than grouped.

@timburke timburke added the enhancement New feature or request label Dec 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant