'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _bunyan; function _load_bunyan() { return _bunyan = _interopRequireDefault(require('@expo/bunyan')); } var _path = _interopRequireDefault(require('path')); var _UserSettings; function _load_UserSettings() { return _UserSettings = _interopRequireDefault(require('./UserSettings')); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } class ConsoleRawStream { write(rec) { if (rec.level < (_bunyan || _load_bunyan()).default.INFO) { console.log(rec); } else if (rec.level < (_bunyan || _load_bunyan()).default.WARN) { console.info(rec); } else if (rec.level < (_bunyan || _load_bunyan()).default.ERROR) { console.warn(rec); } else { console.error(rec); } } } // TODO(perry) teach flow about the logger type here let logger = (_bunyan || _load_bunyan()).default.createLogger({ name: 'expo', serializers: (_bunyan || _load_bunyan()).default.stdSerializers, streams: [{ level: 'debug', type: 'rotating-file', path: _path.default.join((_UserSettings || _load_UserSettings()).default.dotExpoHomeDirectory(), 'log'), period: '1d', // daily rotation count: 3 // keep 3 back copies }, ...(process.env.DEBUG && process.env.NODE_ENV !== 'production' ? [{ type: 'raw', stream: new ConsoleRawStream(), closeOnExit: false, level: 'debug' }] : [])] }); logger.notifications = logger.child({ type: 'notifications' }); logger.global = logger.child({ type: 'global' }); logger.DEBUG = (_bunyan || _load_bunyan()).default.DEBUG; logger.INFO = (_bunyan || _load_bunyan()).default.INFO; logger.WARN = (_bunyan || _load_bunyan()).default.WARN; logger.ERROR = (_bunyan || _load_bunyan()).default.ERROR; exports.default = logger; //# sourceMappingURL=__sourcemaps__/Logger.js.map