RED-3800 safari regex fix

This commit is contained in:
Timo Bejan 2022-05-02 12:44:02 +03:00
parent 2642d9b8cd
commit e896e01665

View File

@ -6,10 +6,12 @@ import { ILoggerConfig } from '@red/domain';
export class LoggerRulesService extends NGXLoggerRulesService {
shouldCallWriter(level: NgxLoggerLevel, config: ILoggerConfig, message?: unknown, additional?: unknown[]): boolean {
if (message && typeof message === 'string') {
const matches = message.match('(?<=\\[)(.*?)(?=\\])');
const matches = message.match('\\[(.*?)\\]');
if (matches && matches.length > 0 && config.features[matches[0]]) {
const featureConfig = config.features[matches[0]];
const firstMatch = matches[1]?.toUpperCase();
if (matches && matches.length > 0 && config.features[firstMatch]) {
const featureConfig = config.features[firstMatch];
if (!featureConfig.enabled || (featureConfig.level && featureConfig?.level < config.level)) {
return false;