import bunyan from 'react-native-bunyan';

// Logging engine for the Logger class which implements the logic
// of creating a log format and hands off the log to a transport
// object.
//
// interface LoggingEngine {
//     trace: (text: string) => void
//     debug: (text: string) => void
//     info: (text: string) => void
//     warn: (text: string) => void
//     error: (text: string) => void
//     fatal: (text: string) => void
//     setLogLevel(transportKey: string, newLevel: int) => void
// }
export class BunyanLoggingEngine {
  streams = [];

  bunyan = null;

  transports = {};

  constructor({ module, transports }) {
    this.transports = transports;
    this.streams = Object.values(transports).map(({ level, write, name }) => ({
      name,
      level,
      stream: { write },
    }));

    this.bunyan = bunyan.createLogger({ name: module, streams: this.streams });
  }

  trace(text) {
    this.bunyan.trace(text);
  }

  debug(text) {
    this.bunyan.debug(text);
  }

  info(text) {
    this.bunyan.info(text);
  }

  warn(text) {
    this.bunyan.warn(text);
  }

  error(text) {
    this.bunyan.error(text);
  }

  fatal(text) {
    this.bunyan.fatal(text);
  }

  setLogLevel(transportKey, newLevel) {
    this.bunyan.levels(transportKey, newLevel);
  }
}

@@ -540,58 +540,21 @@
 %7B%0A  
-streams = %5B%5D;%0A%0A  bunyan = null;%0A%0A  transports = %7B%7D
+bunyan = null
 ;%0A%0A 
@@ -630,21 +630,22 @@
 ts;%0A    
-this.
+const 
 streams 
@@ -832,22 +832,8 @@
 eams
-: this.streams
  %7D);

Add remove unused members