Changeset e29cc2e for trip-planner-front/node_modules/loglevel/lib
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/loglevel/lib/loglevel.js
r59329aa re29cc2e 119 119 var self = this; 120 120 var currentLevel; 121 defaultLevel = defaultLevel == null ? "WARN" : defaultLevel; 121 122 122 123 var storageKey = "loglevel"; … … 172 173 173 174 return storedLevel; 175 } 176 177 function clearPersistedLevel() { 178 if (typeof window === undefinedType || !storageKey) return; 179 180 // Use localStorage if available 181 try { 182 window.localStorage.removeItem(storageKey); 183 return; 184 } catch (ignore) {} 185 186 // Use session cookie as fallback 187 try { 188 window.document.cookie = 189 encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC"; 190 } catch (ignore) {} 174 191 } 175 192 … … 210 227 211 228 self.setDefaultLevel = function (level) { 229 defaultLevel = level; 212 230 if (!getPersistedLevel()) { 213 231 self.setLevel(level, false); 214 232 } 233 }; 234 235 self.resetLevel = function () { 236 self.setLevel(defaultLevel, false); 237 clearPersistedLevel(); 215 238 }; 216 239 … … 226 249 var initialLevel = getPersistedLevel(); 227 250 if (initialLevel == null) { 228 initialLevel = defaultLevel == null ? "WARN" : defaultLevel;251 initialLevel = defaultLevel; 229 252 } 230 253 self.setLevel(initialLevel, false);
Note:
See TracChangeset
for help on using the changeset viewer.