MCPcopy Create free account
hub / github.com/ampproject/amphtml / defaultLevel_

Method defaultLevel_

src/utils/log.js:170–192  ·  view source on GitHub ↗

* @return {!LogLevel_Enum} * @private

()

Source from the content-addressed store, hash-verified

168 * @private
169 */
170 defaultLevel_() {
171 const {win} = this;
172 // No console - can't enable logging.
173 if (
174 !win.console?.log ||
175 // Logging has been explicitly disabled.
176 logHashParam(win) == 0
177 ) {
178 return LogLevel_Enum.OFF;
179 }
180
181 // Logging is enabled for tests directly.
182 if (getMode().test && win.ENABLE_LOG) {
183 return LogLevel_Enum.FINE;
184 }
185
186 // LocalDev by default allows INFO level, unless overridden by `#log`.
187 if (getMode().localDev) {
188 return LogLevel_Enum.INFO;
189 }
190
191 return this.defaultLevelWithFunc_();
192 }
193
194 /**
195 * @param {!Window=} opt_win provided for testing

Callers 1

constructorMethod · 0.95

Calls 3

defaultLevelWithFunc_Method · 0.95
getModeFunction · 0.90
logHashParamFunction · 0.85

Tested by

no test coverage detected