Skip to content

Portal-Api/User

 
 

Repository files navigation

User

Special: log page

JS log

Log all javascript messages to the Drupal log.

What messages or events are logged?

How does it work?

The native console.debug(), console.info(), console.warn(), and console.error() methods are extended with a fetch to the Drupal server, logging appropriate messages. The events are handled with eventListeners in a similar way.

This means there's no need to add any custom javascript code to make this module work!

Installation

  • Enable the module
  • Choose whose messages are logged via admin/people/permissions/module/jslog
  • Fine-tune configuration via /admin/config/system/jslog if needed

DoS protection

Javascript loops can cause a DoS attack on the server. Therefor requests to the server are queued in Promises. Also, there is a configurable limit to the number of messages that can be logged per page.

Extending functionality in the frontend

Whenever a message is logged, the custom jslog event is dispatched. This event can be used to show messages to the frontend if suitable:

addEventListener('jslog', ({detail: {value, level}}) => {
  // value: the log message
  // level: debug, info, notice, warning, or error
}, {passive: false})

Browser support

Dependencies

None

About

Special: log page

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 63.5%
  • JavaScript 36.5%