Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client side logging #1011

Merged
merged 6 commits into from Nov 3, 2015
Merged

Client side logging #1011

merged 6 commits into from Nov 3, 2015

Conversation

carlfeberhard
Copy link
Contributor

This re-tools the client-side metrics/logging stuff to allow developers (and end users) to turn console logging on and off, have it persist across sessions, and capture logging at page start (to show initialization). The use-case is a developer/user who wants to review logs of what's occurring in the browser during an error or operation from multiple sources without having to add watch statements for each.

To test:

  1. open the galaxy homepage in a browser and open the javascript console
  2. enter: Galaxy.debugging( true )
  3. refresh the page
    -> You should see a large amount of logging messages prefixed by their namespaces ('GalaxyApp', 'history', 'collection', etc.)

To focus/filter on a particular namespace:

  1. in the console, enter: Galaxy.debuggingNamespaces([ 'collections', 'GalaxyApp' ])
    -> Only logging from the collections and GalaxyApp namespaces are shown. Hopefully, this allows a decrease in noise v. signal.

To turn off namespace filtering: Galaxy.debuggingNamespaces( null )
To turn off debugging: Galaxy.debugging( false )
(You'll need to refresh the page for these to take effect usually)

These settings use localStorage and are persistent across sessions and tabs/windows.

To add namespacing and logger messages to your javascript objects:

  • Extend MVC objects from base-mvc.LoggableMixin, call add-logging.addLogging( obj, namespace ) for other objects
  • Call this.log, this.debug, this.warn, etc. from within methods
  • I've found broader namespaces (per mvc directory) to be useful so far

To be improved at some point during the current epoch:

  • filename and lineno are lost due to limited console flexibility across browsers
  • namespacing could be made easier (again a lack of __filename)

Tested in: Firefox, Chrome, Opera, Safari, Win7+IE11, Win10+Edge

@guerler

@carlfeberhard carlfeberhard changed the title Logging Client side logging Oct 30, 2015
@martenson
Copy link
Member

This is awesome. Awesome. Works well on osx 10.11.1 Chrome, FF, Safari
👍

@dannon
Copy link
Member

dannon commented Nov 3, 2015

+1

dannon added a commit that referenced this pull request Nov 3, 2015
@dannon dannon merged commit 86648d2 into galaxyproject:dev Nov 3, 2015
@carlfeberhard carlfeberhard deleted the logging branch December 7, 2015 14:47
@jmchilton jmchilton modified the milestone: 16.01 Jan 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants