<commit_before>js\_loggable
============
Server Side Logging of Client JavaScript Errors
-----------------------------------------------

Sometimes you have the need to suppress all client side javascript... but it would be nice to know if the are issues happening in production. _js\_loggable_ is designed trap any client side javascript errors and send them back to your application to log them         

Status
======
This is _not_ a functional plugin yet. I have the a ways to go before this is even Alpha. This will for sure break stuff if you install it.

TODO
======
• Make the javascript agnostic. Currently it is jQuery
• Have the partial with the js required included automatically in any template that gets rendered by an action
• Namespace the javascript functions


Example
=======
Controller you want to log javascript for

    class Blog < ApplicationController
      include JsLoggable
      layout "layout"
  
      log_javascript :index
  
      def index
      end
  
      def show
      end
  
    end

View that is generated

      &lt;script type="text/javascript" charset="utf-8"&gt;
      function jsLoggableLogError(e) {
        try {
          $.post( '/js_loggable/new', { navigator: encodeURI(navigator.userAgent),
                                            timestamp: encodeURI(Date()),  
                                            errormsg: encodeURI(e),
                                            location: window.location }
                 ); 
          return true;
        } catch(e) {
          // don't error 
          return true; 
        }
      }
    window.onerror = jsLoggableLogError;
    alert(james); //this will error
    &lt;/script&gt;

  hello world



Copyright (c) 2009 <NAME>, released under the MIT license<commit_msg>hey what do you know... more markdown<commit_after>js\_loggable
============
Server Side Logging of Client JavaScript Errors
-----------------------------------------------

Sometimes you have the need to suppress all client side javascript... but it would be nice to know if the are issues happening in production. _js\_loggable_ is designed trap any client side javascript errors and send them back to your application to log them         

Status
======
This is _not_ a functional plugin yet. I have the a ways to go before this is even Alpha. This will for sure break stuff if you install it.

TODO
======
• Make the javascript agnostic. Currently it is jQuery
• Have the partial with the js required included automatically in any template that gets rendered by an action
• Namespace the javascript functions


Example
=======
Controller you want to log javascript for

    class Blog < ApplicationController
      include JsLoggable
      layout "layout"
  
      log_javascript :index
  
      def index
      end
  
      def show
      end
  
    end

View that is generated

      <script type="text/javascript" charset="utf-8">
        function jsLoggableLogError(e) {
          try {
            $.post( '/js_loggable/new', { navigator: encodeURI(navigator.userAgent),
                                              timestamp: encodeURI(Date()),  
                                              errormsg: encodeURI(e),
                                              location: window.location }
                   ); 
            return true;
          } catch(e) {
            // don't error 
            return true; 
          }
        }
      window.onerror = jsLoggableLogError;
      alert(james); //this will error
    </script>

  hello world



Copyright (c) 2009 <NAME>, released under the MIT license
{'fraction_non_alphanumeric': 0.09538375973303671, 'fraction_numerical': 0.0027808676307007787, 'mean_word_length': 1.8822115384615385, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1947864', 'n_tokens_mistral': 896, 'n_tokens_neox': 833, 'n_words': 375}