Permalink
Browse files

Removed castor due to licensing restrictions, and changed the readme

to recommend the use of janky.post directly.
  • Loading branch information...
1 parent a64c6f6 commit fe12b32eec1b88eca46e36581af90186f559378b Mark Cahill committed Sep 12, 2011
Showing with 3 additions and 108 deletions.
  1. +0 −108 castor.js
  2. +3 −0 readme.md
View
108 castor.js
@@ -1,108 +0,0 @@
-/**
- * Castor - a cross site POSTing JavaScript logging library for Loggly
- *
- * Copyright (c) 2011 Loggly, Inc.
- * All rights reserved.
- *
- * Author: Kord Campbell <kord@loggly.com>
- * Date: May 2, 2011
- *
- * Uses methods from janky.post, copyright(c) 2011 Thomas Rampelberg <thomas@saunter.org>
- *
- * Sample usage (replace with your own Loggly HTTP input URL):
-
- <script src="/js/loggly.js" type="text/javascript"></script>
- <script type="text/javascript">
- window.onload=function(){
- castor = new loggly({ url: 'http://logs.loggly.com/inputs/a4e839e9-4227-49aa-9d28-e18e5ba5a818?rt=1', level: 'WARN'});
- castor.log(object);
- }
- </script>
-
- */
-
-(function() {
- this.loggly = function(opts) {
- this.user_agent = get_agent();
- this.browser_size = get_size();
- log_methods = {'error': 5, 'warn': 4, 'info': 3, 'debug': 2, 'log': 1};
- if (!opts.url) throw new Error("Please include a Loggly HTTP URL.");
- if (!opts.level) {
- this.level = log_methods['info'];
- } else {
- this.level = log_methods[opts.level];
- }
- this.log = function(data) {
- if (log_methods['log'] == this.level) {
- opts.data = data;
- janky(opts);
- }
- };
- this.debug = function(data) {
- if (log_methods['debug'] >= this.level) {
- opts.data = data;
- janky(opts);
- }
- };
- this.info = function(data) {
- if (log_methods['info'] >= this.level) {
- opts.data = data;
- janky(opts);
- }
- };
- this.warn = function(data) {
- if (log_methods['warn'] >= this.level) {
- opts.data = data;
- janky(opts);
- }
- };
- this.error = function(data) {
- if (log_methods['error'] >= this.level) {
- opts.data = data;
- janky(opts);
- }
- };
- };
- this.janky = function(opts) {
- janky._form(function(iframe, form) {
- form.setAttribute("action", opts.url);
- form.setAttribute("method", "post");
- janky._input(iframe, form, opts.data);
- form.submit();
- setTimeout(function(){
- document.body.removeChild(iframe);
- }, 2000);
- });
- };
- this.janky._form = function(cb) {
- var iframe = document.createElement("iframe");
- document.body.appendChild(iframe);
- iframe.style.display = "none";
- setTimeout(function() {
- var form = iframe.contentWindow.document.createElement("form");
- iframe.contentWindow.document.body.appendChild(form);
- cb(iframe, form);
- }, 0);
- };
- this.janky._input = function(iframe, form, data) {
- var inp = iframe.contentWindow.document.createElement("input");
- inp.setAttribute("type", "hidden");
- inp.setAttribute("name", "source");
- inp.value = data;
- form.appendChild(inp);
- };
- this.get_agent = function () {
- return navigator.appCodeName + navigator.appName + navigator.appVersion;
- };
- this.get_size = function () {
- var width = 0; var height = 0;
- if( typeof( window.innerWidth ) == 'number' ) {
- width = window.innerWidth; height = window.innerHeight;
- } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
- width = document.documentElement.clientWidth; height = document.documentElement.clientHeight;
- } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
- width = document.body.clientWidth; height = document.body.clientHeight;
- }
- return {'height': height, 'width': width};
- };
-})();
View
3 readme.md
@@ -24,6 +24,9 @@ TELEMETRY_CONFIG environment variables like so:
export TELEMETRY_CONFIG=~/.telemetry; telemetry
+Events can be sent to node-telemetry by any HTTP client capable of a POST. For
+javascript on the browser, you can use [janky.post](https://github.com/pyronicide/janky.post).
+
If you are interested in creating additional backends for telemetry, or need
general assistance, contact me using the e-mail address displayed when you do

0 comments on commit fe12b32

Please sign in to comment.