diff --git a/README.md b/README.md index aca11f8..5155e28 100644 --- a/README.md +++ b/README.md @@ -2,27 +2,37 @@ JavaScript library to do cross site log POSTing to Loggly. You can use this to log directly out of your JavaScript to Loggly, or just record the fact someone hit a page on your site. +## Live Demo + + + ## Installation + Include the loggly.js file in a web page. You can use our CloudFront version if you like: -
http://cloudfront.loggly.com/js/loggly-0.1.0.js
+
http://cloudfront.loggly.com/js/loggly-0.2.1.js
Create a new HTTP input in your Loggly account, make a note of the URL, and then edit and use the following code in that same web page: -
-   
-
+### Simple Example + +```js +window.onload = function() { + castor = new loggly({ url: 'http://logs.loggly.com/inputs/a2e232e9-4827-49aa-9d28-e18e5ba5a818?rt=1', level: 'info'}) + castor.info("url=" + window.location.href + " browser=" + castor.user_agent + " width=" + castor.browser_size.width) +} +``` -This should result in the page posting an event to Loggly that looks something like this: +This should result in the page posting an event to Loggly that looks something like this: -
+```js
 source=castor url=http://www.geekceo.com/ browser=MozillaNetscape5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24 width=1009
-
+``` + +### Extended Example + +See the live demo link above. ## Log Levels + Set the log level using the *level: 'info'* parameter. Call the library using the error, warn, info, debug and log methods. Events called with these methods that match or exceed the current logging level will be forwarded on to Loggly. diff --git a/index.html b/index.html index feb5c52..23138ef 100644 --- a/index.html +++ b/index.html @@ -1,33 +1,93 @@ - Loggly Javascript Logging Example + loggly-castor - Client-side JavaScript Logging Example - - - - - - - + + + + +
-

sending test event

-

© 2012 Loggly, Inc.

+

loggly-castor example (view source)

+

© 2012 Loggly, Inc.

+ + + + +