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

Support special characters readability #54

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

Always

Just for now

@@ -1,6 +1,6 @@
{
"name": "loggly-jslogger",
"version": "2.2.2",
"version": "2.2.3",
"description": "A Javascript client to send logs to Loggly.",
"browser": "index.js",
"repository": {
@@ -18,6 +18,7 @@
this.sendConsoleErrors = false;
this.tag = 'jslogger';
this.useDomainProxy = false;
this.useUtfEncoding = false;
}

function setKey(tracker, key) {
@@ -36,6 +37,10 @@
setInputUrl(tracker);
}

function setUtfEncoding(tracker, useUtfEncoding){
tracker.useUtfEncoding = useUtfEncoding;
}

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

@@ -124,6 +129,10 @@
setTag(self, data.tag);
}

if (data.useUtfEncoding !== undefined) {
setUtfEncoding(self, data.useUtfEncoding);
}

if (data.useDomainProxy) {
setDomainProxy(self, data.useDomainProxy);
}
@@ -155,7 +164,11 @@
//creating an asynchronous XMLHttpRequest
var xmlHttp = new XMLHttpRequest();
xmlHttp.open('POST', this.inputUrl, true); //true for asynchronous request
xmlHttp.setRequestHeader('Content-Type', 'text/plain');
if (tracker.useUtfEncoding === true) {

This comment has been minimized.

@psamit

psamit Aug 2, 2018

useUtfEncoding is already a boolean so no need to check with true, false or undefined.

data.useUtfEncoding for true and !data.useUtfEncoding for false or undefined will be sufficient here.

This comment has been minimized.

@psamit

psamit Aug 2, 2018

Changes looks good to me.

This comment has been minimized.

@Shwetajain148

Shwetajain148 Aug 2, 2018
Author Contributor

Got it, thanks @psamit .

xmlHttp.setRequestHeader('Content-Type', 'text/plain; charset=utf-8');
} else {
xmlHttp.setRequestHeader('Content-Type', 'text/plain');
}
xmlHttp.send(JSON.stringify(data));

} catch (ex) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.