From d5f7eec601f5ecd83efed9811b3cbffd35659fc0 Mon Sep 17 00:00:00 2001 From: Nick Baugh Date: Tue, 4 Sep 2012 09:07:40 -0400 Subject: [PATCH 1/3] Added new example with updated version and asynchronous loading --- README.md | 26 +++++++------- index.html | 100 ++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 93 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index aca11f8..370f074 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,20 @@ Include the loggly.js file in a web page. You can use our CloudFront version if 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: -
-   
-
- -This should result in the page posting an event to Loggly that looks something like this: - -
+```html
+
+```
+
+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
-
+``` ## 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..e092865 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.

+ + From 2f167809ee5419736122ffa06f4f57095635481f Mon Sep 17 00:00:00 2001 From: Nick Baugh Date: Tue, 4 Sep 2012 09:11:22 -0400 Subject: [PATCH 2/3] Fixed typo `this` -> `_loggly` --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index e092865..5ca2ea3 100644 --- a/index.html +++ b/index.html @@ -38,7 +38,7 @@

loggly-castor example (view source)

_loggly.src = _loggly.paths[_castor.p] _loggly.key = "a00039e9-4827-49aa-9d28-e18e5ba5a818" _loggly.config = { - url : this.src + '/inputs/' + this.key + url : _loggly.src + '/inputs/' + _loggly.key , level : 'log' } From cacbc88593ee68d23d02127f5839b0fd6345539f Mon Sep 17 00:00:00 2001 From: Nick Baugh Date: Tue, 4 Sep 2012 09:19:42 -0400 Subject: [PATCH 3/3] Updated example --- README.md | 26 ++++++++++++++++++-------- index.html | 14 +++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 370f074..5155e28 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,25 @@ 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: -```html - +### 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: @@ -24,5 +29,10 @@ This should result in the page posting an event to Loggly that looks something l 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 5ca2ea3..23138ef 100644 --- a/index.html +++ b/index.html @@ -3,16 +3,18 @@ loggly-castor - Client-side JavaScript Logging Example - - - + + + +

loggly-castor example (view source)

© 2012 Loggly, Inc.

+ + +