@assistant/conversation
Version:
Actions SDK Fulfillment Library for Node.js
53 lines • 2.06 kB
JavaScript
;
/**
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLogger = exports.setLogger = exports.debugLogger = void 0;
const Debug = require("debug");
const name = 'assistant-conversation';
// Use `Firebase Logger SDK` or `console` as default
const defaultLogger = (() => {
return {
debug: Debug(`${name}:debug`),
// tslint:disable-next-line:no-console Allow console binding
info: console.info.bind(console),
warn: Debug(`${name}:warn`),
// tslint:disable-next-line:no-console Allow console binding
log: console.log.bind(console),
// tslint:disable-next-line:no-console Allow console binding
error: console.error.bind(console),
};
})();
// Same as default, but `debug` messages are now `info` level
exports.debugLogger = {
// tslint:disable-next-line:no-console Allow console binding
debug: console.info.bind(console),
// tslint:disable-next-line:no-console Allow console binding
info: console.info.bind(console),
warn: Debug(`${name}:warn`),
// tslint:disable-next-line:no-console Allow console binding
log: console.log.bind(console),
// tslint:disable-next-line:no-console Allow console binding
error: console.error.bind(console),
};
let logger = defaultLogger;
exports.setLogger = (newLogger = defaultLogger) => {
logger = newLogger;
};
exports.getLogger = () => {
return logger;
};
//# sourceMappingURL=logger.js.map