Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy domain support #27

Merged
merged 3 commits into from Aug 3, 2015
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Supporting proxy domains

  • Loading branch information
varshneyjayant committed Jul 31, 2015
commit fdcc516490fb4d4b7b9b69b577ddd1824c908de3
@@ -3,6 +3,7 @@
LOGGLY_COLLECTOR_DOMAIN = 'logs-01.loggly.com',
LOGGLY_SESSION_KEY = 'logglytrackingsession',
LOGGLY_SESSION_KEY_LENGTH = LOGGLY_SESSION_KEY.length + 1;
LOGGLY_PROXY_DOMAIN = 'loggly';

function uuid() {
// lifted from here -> http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
@@ -14,8 +15,9 @@

function LogglyTracker() {
this.key = false;
this.sendConsoleErrors = false;
this.sendConsoleErrors = false;
this.tag = 'jslogger';
this.useDomainProxy = false;
}

function setKey(tracker, key) {
@@ -28,6 +30,12 @@
tracker.tag = tag;
}

function setDomainProxy(tracker, useDomainProxy){
tracker.useDomainProxy = useDomainProxy;
//refresh inputUrl value
setInputUrl(tracker);
}

function setSendConsoleError(tracker, sendConsoleErrors) {
tracker.sendConsoleErrors = sendConsoleErrors;

@@ -53,12 +61,25 @@
}

function setInputUrl(tracker) {
tracker.inputUrl = LOGGLY_INPUT_PREFIX
+ (tracker.logglyCollectorDomain || LOGGLY_COLLECTOR_DOMAIN)
+ '/inputs/'
+ tracker.key
+ '/tag/'
+ tracker.tag;

if(tracker.useDomainProxy == true){
tracker.inputUrl = LOGGLY_INPUT_PREFIX
+ window.location.host
+ '/'
+ LOGGLY_PROXY_DOMAIN
+ '/inputs/'
+ tracker.key
+ '/tag/'
+ tracker.tag;
}
else{
tracker.inputUrl = LOGGLY_INPUT_PREFIX
+ (tracker.logglyCollectorDomain || LOGGLY_COLLECTOR_DOMAIN)
+ '/inputs/'
+ tracker.key
+ '/tag/'
+ tracker.tag;
}
}

LogglyTracker.prototype = {
@@ -88,7 +109,7 @@
data = {
'text': data
};
} else {
} else {
if(data.logglyCollectorDomain) {
self.logglyCollectorDomain = data.logglyCollectorDomain;
return;
@@ -97,11 +118,14 @@
if(data.sendConsoleErrors !== undefined) {
setSendConsoleError(self, data.sendConsoleErrors);
}



if(data.tag) {
setTag(self, data.tag);
}

if(data.useDomainProxy){
setDomainProxy(self, data.useDomainProxy);
}

if(data.logglyKey) {
setKey(self, data.logglyKey);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.