Skip to content

maxfrigge/cerebral-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cerebral-log

A log helper for cerebral. Logs system events by default but can also be used for custom logs.

It's an early draft with bugs and many breaking changes to come!

import CerebralLog from 'cerebral-log'

CerebralLog(controller, {
  patchConsole: false,
  globalLog: false
})

The logs are filtered with levels using loglevel. The default log level is warn.

Patch console

When patchConsole = true the global console object will be patched to use loglevel methods - that way you don't pollute your code with a log dependency and you can filter all calls to the standard console.

Global log

When globalLog = true the log object from loglevel will be expose in the global namespace (window). This is useful to change the log level form your browsers console.

log.enableAll()
log.diasbleAll()
log.setLevel('info')

For a complete reference of loglevel please visit it's github repository.

Could happen in the future

  • Advanced filters (maybe based on tags?)
  • Export console to selectively override the default console in a file
  • Maybe add performance helper (e.g. timers)

Feedback, new ideas and pull request are welcome :)

About

A logging library for cerebral

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published