Skip to content

Commit

Permalink
chore: disable realtime logger in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dpyzo0o committed Dec 30, 2019
1 parent 5c63468 commit fa87ccd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/utils/log.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import Taro from '@tarojs/taro';

const log = Taro.getRealtimeLogManager();
const isDev = process.env.NODE_ENV === 'development';

export default {
info(...args: any[]) {
if (!log) {
if (!log || isDev) {
return;
}
log.info(...args);
},
warn(...args: any[]) {
if (!log) {
if (!log || isDev) {
return;
}
log.warn(...args);
},
error(...args: any[]) {
if (!log) {
if (!log || isDev) {
return;
}
log.error(...args);
Expand All @@ -27,7 +28,7 @@ export default {
* @since 2.7.3
*/
setFilterMsg(msg: string) {
if (!log || !log.setFilterMsg) {
if (!log || !log.setFilterMsg || isDev) {
return;
}
log.setFilterMsg(msg);
Expand All @@ -38,7 +39,7 @@ export default {
* @since 2.8.1
*/
addFilterMsg(msg: string) {
if (!log || !log.addFilterMsg) {
if (!log || !log.addFilterMsg || isDev) {
return;
}
log.addFilterMsg(msg);
Expand Down

0 comments on commit fa87ccd

Please sign in to comment.