LogLevel flag

This commit is contained in:
Hetu Nandu 2020-03-27 12:46:29 +00:00
parent cabcd2e0a2
commit 3b3cab3a5f

View File

@ -10,6 +10,8 @@ import _ from "lodash";
import moment from "moment-timezone";
import ValidationRegistry from "./ValidationRegistry";
import * as log from "loglevel";
import { LogLevelDesc } from "loglevel";
import { AppsmithUIConfigs } from "configs/types";
export const createReducer = (
initialState: any,
@ -40,8 +42,7 @@ export const appInitializer = () => {
if (appsmithConfigs.segment.enabled) {
AnalyticsUtil.initializeSegment(appsmithConfigs.segment.key);
}
log.setLevel(appsmithConfigs.logLevel);
log.setLevel(getEnvLogLevel(appsmithConfigs.logLevel));
const textFont = new FontFaceObserver("DM Sans");
textFont
@ -91,3 +92,10 @@ export const convertToString = (value: any): string => {
if (_.isString(value)) return value;
return value.toString();
};
const getEnvLogLevel = (configLevel: LogLevelDesc): LogLevelDesc => {
let logLevel = configLevel;
const localStorageLevel = localStorage.getItem("logLevel") as LogLevelDesc;
if (localStorageLevel) logLevel = localStorageLevel;
return logLevel;
};