mowispace / react-native-logs

Performance-aware simple logger for React-Native and Expo with namespaces, custom levels and custom transports (colored console, file writing, etc.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable method is not working for extensions

turbomonkey opened this issue · comments

I tried to use the disable method on an extension but cannot get it to work. It just disables all logging. Could you please provide an example? Thanks!

import { logger, consoleTransport } from "react-native-logs";

const config = {
  transport: consoleTransport,
  enabledExtensions: ['ROOT','HOME']
};

var log = logger.createLogger(config);
var rootLog = log.extend('ROOT');
var homeLog = log.extend('HOME');

log.disable('HOME');
log.disable(homeLog);

rootLog.info('Magenta Extension and bright blue message');
homeLog.error('Green Extension and bright red message');

Sorry, I'll fix this in the next few days

Fixed in ver 4.0.1, see the example in the README.