Permalink
Browse files

Add LICENSE & README

  • Loading branch information...
1 parent 9978e08 commit 734b12a30d6f56fc4bde20f30c333b83cd5920bc @Seldaek Seldaek committed Aug 20, 2012
Showing with 91 additions and 1 deletion.
  1. +19 −0 LICENSE
  2. +71 −0 README.md
  3. +1 −1 composer.json
View
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Nelmio
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -0,0 +1,71 @@
+NelmioJsLoggerBundle
+====================
+
+The **NelmioJsLoggerBundle** bundle allows you to log errors happening in the frontend.
+
+## Installation ##
+
+Add this bundle to your `composer.json` file:
+
+ {
+ "require": {
+ "nelmio/js-logger-bundle": "dev-master"
+ }
+ }
+
+Register the bundle in `app/AppKernel.php`:
+
+ // app/AppKernel.php
+ public function registerBundles()
+ {
+ return array(
+ // ...
+ new Nelmio\JsLoggerBundle\NelmioJsLoggerBundle(),
+ );
+ }
+
+Import the bundle's routing definition in `app/config/routing.yml`:
+
+ # app/config/routing.yml
+ NelmioJsLoggerBundle:
+ resource: "@NelmioJsLoggerBundle/Resources/config/routing.xml"
+ prefix: /nelmio-js-logger
+
+## Automated Error Logging ##
+
+The bundle exposes two twig functions that you should put in your site template somewhere.
+
+To enable automatic logging of javascript errors, use `nelmio_js_error_logger()`:
+
+ {{ nelmio_js_error_logger() }}
+
+You can optionally change the level (default is ERROR) and remove the surrounding `<script>..</script>` tags:
+
+ {{ nelmio_js_error_logger('WARNING', false) }}
+
+## Manual Logging from JavaScript ##
+
+To expose the `log()` function to your JS code, use `nelmio_js_logger()`:
+
+ {{ nelmio_js_logger() }}
+
+You can also change the function name if `log` is too generic for you:
+
+ {{ nelmio_js_logger('my_log_function') }}
+
+The function signature is as such: `log(level, message, context)`. The level and
+message are mandatory. The context is a data object that can contain any additional
+details you want to store.
+
+## Configuration ##
+
+You can restrict the logging levels accessible from javascript. The point
+is that if some of your logging levels email you or notify you in some way,
+you probably do not want to allow anyone to send requests and wake you up
+at 2AM.
+
+Here is the default configuration that exposes all levels:
+
+ # app/config/config.yml
+ nelmio_js_logger:
+ allowed_levels: ['DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR', 'CRITICAL', 'ALERT', 'EMERGENCY']
View
@@ -15,7 +15,7 @@
}
],
"require": {
- "symfony/framework-bundle": ">=2.1,<2.2-dev"
+ "symfony/framework-bundle": ">=2.0,<2.2-dev"
},
"autoload": {
"psr-0": { "Nelmio\\JsLoggerBundle": "" }

0 comments on commit 734b12a

Please sign in to comment.