document.getElementById('setLogLevelForm').addEventListener('submit', function(e) {
  e.preventDefault();
  const level = document.getElementById('appLogLevel').value;
  fetch(SET_LOG_LEVEL_URL, {
    method: 'POST',
    headers: {'Content-Type': 'application/x-www-form-urlencoded'},
    body: 'level=' + encodeURIComponent(level)
  })
  .then(res => res.json())
  .then(data => {
    window.showToast({ text: data.message, variant: 'success' });
  })
  .catch(() => {
    window.showToast({ text: "Błąd podczas zmiany poziomu", variant: "error" });
  });
});
