// #/logging sammy.get ( /^#\/(logging)$/, function( context ) { var content_element = $( '#content' ); content_element .html( '
' ); $.ajax ( { url : 'logging.json', dataType : 'json', context : $( '#logging', content_element ), beforeSend : function( xhr, settings ) { this .html( '
Loading ...
' ); }, success : function( response, text_status, xhr ) { var logger = response.logger; var loglevel = '
' + "\n"; loglevel += '%effective_level%' + "\n"; loglevel += '' + "\n"; loglevel += '
'; var logger_tree = function( filter ) { var logger_content = ''; var filter_regex = new RegExp( '^' + filter + '\\.\\w+$' ); for( var logger_name in logger ) { var continue_matcher = false; if( !filter ) { continue_matcher = logger_name.indexOf( '.' ) !== -1; } else { continue_matcher = !logger_name.match( filter_regex ); } if( continue_matcher ) { continue; } var has_logger_instance = !!logger[logger_name]; var classes = []; has_logger_instance ? classes.push( 'active' ) : classes.push( 'inactive' ); logger_content += '
  • '; logger_content += ' '; logger_content += '' + "\n" + logger_name.split( '.' ).pop().esc() + "\n" + ''; logger_content += loglevel .replace ( /%class%/g, classes.join( ' ' ) ) .replace ( /%effective_level%/g, has_logger_instance ? logger[logger_name].effective_level : 'null' ); var child_logger_content = logger_tree( logger_name ); if( child_logger_content ) { logger_content += ''; } logger_content += '
  • '; } return logger_content; } var logger_content = logger_tree( null ); var warn = '
    TODO, this is not yet implemented. For now, use the old logging UI

    ' this.html( warn + '' ); $( 'li:last-child', this ) .addClass( 'jstree-last' ); $( '.loglevel', this ) .each ( function( index, element ) { var element = $( element ); var effective_level = $( '.effective_level span', element ).text(); element .css( 'z-index', 800 - index ); $( 'ul .' + effective_level, element ) .addClass( 'selected' ); } ); $( '.trigger', this ) .die( 'click' ) .live ( 'click', function( event ) { $( '.loglevel', $( this ).parents( 'li' ).first() ).first() .trigger( 'toggle' ); } ); $( '.loglevel', this ) .die( 'toggle') .live ( 'toggle', function( event ) { $( this ) .toggleClass( 'open' ); } ); }, error : function( xhr, text_status, error_thrown) { }, complete : function( xhr, text_status ) { } } ); } );