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

injecting log to any javascript function #51

Open
wants to merge 10 commits into
base: master
from

ReadMe to explain how to use the log injection

  • Loading branch information
dhewzulla committed Nov 8, 2017
commit 32c09786df2b757e10d7071e3913d71e95fcd11d
@@ -136,44 +136,52 @@ _LTracker.push({

The name of the variable ```error``` is coming from the ```name``` attribute passed into the ```_LTracker.injectLog``` in the previous example.

The input parameter is an object, for example:
If the input parameter is an object, for example:

```Javascript
console.error({errorcode:"Error01", description:"Something goes wrong"});
```
The injected code will execute:
the injected code will execute:

```Javascript
_LTracker.push({
error:{errorcode:"Error01", description:"Something goes wrong"}
})
```
If multiple parameters are passed in:
If multiple parameters are passed in to the function:

```Javascript
console.error("Something wrong", {errorCode:"001", errorCotent:"wierd error"});
```

The injected code will execute:
```Javascript
_LTracker.push({
error:{param1:"Something wrong", param2:{errorCode:"001", errorCotent:"wierd error"}}
})
```

On other hand if the injected function has the return value, for example if we have the following:
On other hand if the injected function has the return value, for example if the following is executed as soon as the Loggly is initializez:

```Javascript
LTracker.injectLog({
name:"LocalStorageLog"
target:"localStorage.getItem",
enable:100
});
```
The Loggly will monitor ```localStorage.getUten``` function.

if the application executes:

So if the application executes:
```Javascript
var username=localStorage.getItem("username");
```

and if the returned value from the localStorage is "dilshat"

then injected code executes the following:

```Javascript
_LTracker.push({
LocalStorageLog:{input:"username", output:"dilshat}
})
```
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.