2022-09-02 17:15:08 +00:00
|
|
|
import { getAppsmithConfigs } from "@appsmith/configs";
|
2022-08-04 05:40:44 +00:00
|
|
|
import FormControlRegistry from "./formControl/FormControlRegistry";
|
|
|
|
|
import { LogLevelDesc } from "loglevel";
|
|
|
|
|
import localStorage from "utils/localStorage";
|
|
|
|
|
import * as log from "loglevel";
|
|
|
|
|
|
|
|
|
|
export const appInitializer = () => {
|
|
|
|
|
FormControlRegistry.registerFormControlBuilders();
|
|
|
|
|
const appsmithConfigs = getAppsmithConfigs();
|
|
|
|
|
log.setLevel(getEnvLogLevel(appsmithConfigs.logLevel));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const getEnvLogLevel = (configLevel: LogLevelDesc): LogLevelDesc => {
|
|
|
|
|
let logLevel = configLevel;
|
|
|
|
|
if (localStorage && localStorage.getItem) {
|
|
|
|
|
const localStorageLevel = localStorage.getItem(
|
|
|
|
|
"logLevelOverride",
|
|
|
|
|
) as LogLevelDesc;
|
|
|
|
|
if (localStorageLevel) logLevel = localStorageLevel;
|
|
|
|
|
}
|
|
|
|
|
return logLevel;
|
|
|
|
|
};
|