cerner / canadarm Goto Github PK
View Code? Open in Web Editor NEWA JavaScript logger that works for you!
License: Apache License 2.0
A JavaScript logger that works for you!
License: Apache License 2.0
Right now this line https://github.com/cerner/canadarm/blob/master/lib/handler/console.js#L44 in the console log handler assumes there is a logAttribute.msg
attribute. If you are not using the standard log appender then the attribute does not exist and the output just shows undefined, which is confusing.
Need to fix this to not assume the value exists. If it exists we should log it, if not don't log it.
Sometimes standardLogAppender exception param is undefined in Safari, which is causing canadarm to blow up on this line https://github.com/cerner/canadarm/blob/master/build/canadarm.js#L470
Maybe it should check the stack variable defined on line 388?
Or check if exception is undefined on line 470?
Currently this repository lacks detailed documentation on Canadarm.local
and Canadarm.watch
. I'd like to see some examples added and example use cases added.
Right now we have a "beaconHandler" that is really a hack around using the Image.src
.
It should get support in IE Edge in the future.
For now I think feature detection that uses navigator.sendBeacon
may be the way to go. Then for browser that do not support it fall back to the hacky Image.src
method.
Here is the specification for the feature: http://www.w3.org/TR/beacon/
More "user friendly" detail here: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon
@mhemesath brought this up awhile ago. I saw it again while browsing http://caniuse.com/#search=sent
@mhemesath and I have had ideas about how to gather analytics using Canadarm. Since we have the beaconHandler
it would work pretty nicely for sending that information.
The thought I have right now to handle this is to create a second library that "shims" to the Canadarm object a Canadarm.analytics
that works similarly to how the logging works now. It'll have a lot of defaults that it will put out, but you can pass in your own custom attributes as well. Here are some ideas of how it could work:
// The normal case
Canadarm.analytics()
// Adding custom data
Canadarm.analytics(
{
user_id: '123-8238fj',
date_of_birth: '2014-05-10'
}
);
// How setup could work:
Canadarm.analytics.session_id = 'blah'
I think implementation would be done via a custom handler that was only triggered via the Canadarm.analytics
call. We would plan to use all the same Appenders
so that you get the error and analytic information all the time. If desired it could also be decoupled, I'm not 100% sure yet.
To help out systems using Canadarm we should fire an event when an error occurs.
I'm building an isomorphic application which executes the same code both on a node-server and in the browser.
When I manually call Canadarm.warn('test')
in the "node-context" I get the following error:
project/node_modules/canadarm/build/canadarm.js:472
var scripts = window.document.getElementsByTagName('script');
^
TypeError: window.document.getElementsByTagName is not a function
at standardLogAppender (project/node_modules/canadarm/build/canadarm.js:472:35)
at gatherErrors (project/node_modules/canadarm/build/canadarm.js:278:18)
at Object.warn (project/node_modules/canadarm/build/canadarm.js:337:15)
at Object.module.exports.Object.defineProperty.value (project/dist/server/index.js:1115:19)
at __webpack_require__ (project/dist/server/index.js:508:30)
at fn (project/dist/server/index.js:39:20)
at Object.<anonymous> (project/dist/server/index.js:967:13)
at __webpack_require__ (project/dist/server/index.js:508:30)
at fn (project/dist/server/index.js:39:20)
at Object.module.exports.Object.defineProperty.value (project/dist/server/index.js:926:14)
error: Forever detected script exited with code: 1
The code in Canadarm which does this is:
// If stack is not defined we are in a browser that does not fully support our logging.
// Or one of our custom loggers was called, e.g. Logger.debug('message').
if (exception === undefined || exception === null || exception.stack === null) {
var scripts = window.document.getElementsByTagName('script');
scriptURL = (window.document.currentScript || scripts[scripts.length - 1]).src;
}
Is Canadarm supposed to work with my kind of setup?
It's reasonable at this point to drop IE8 support and release a v2.0.0 of this project
Due to the inactivity of this project for over 1 year, this project is marked to be archived at end of January 2024. Previously release assets will be untouched, but support will cease for this project going forward. If anyone has any reasons this project should not be archived, please comment.
I started a Google Group: https://groups.google.com/forum/#!forum/canadarm
We should document this group and add it to the repository.
This may be too simple to add in here, maybe just make it documentation.
Sentry is a really good log aggregation platform that has a client for logging out errors. I'm thinking we would just make a handler that wraps the Raven logger.
We're currently running into issues with the recaptcha api. It seems that an issue with the recaptcha api prevented the captcha from rendering on the page.
Here's the error seen in the browser:
canadarm.js:597 Uncaught TypeError: Cannot set property '_wrapper' of null
at _watchFn (canadarm.js:597)
at Object.Canadarm.watch (canadarm.js:615)
at window.EventTarget.addEventListener (canadarm.js:767)
at recaptcha__en.js:39
at recaptcha__en.js:39
at recaptcha__en.js:411
canadarm.js:471 Uncaught TypeError: Cannot read property 'stack' of null
at standardLogAppender (canadarm.js:471)
at gatherErrors (canadarm.js:278)
at Object.fatal (canadarm.js:337)
at _onError (canadarm.js:713)
We have requested a fix to google's recaptcha, but would also like to see a fix to canadarm. This fix would allow issues with the recaptcha api to pass through canadarm and not affect the application.
https://groups.google.com/forum/#!topic/recaptcha/FPkQ8VFY0zI
google/recaptcha#166
Right now we have an insufficient amount of tests for the standardLogAppender
. Need to add more testing all paths of possible code execution.
This could lead to rewriting the appender a little to be more unit testable.
We need to figure out a strategy for hosting canadarm. It's a hassle to ask people to copy paste the source. If we had it on a place like cdnjs that would be great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.