-
Notifications
You must be signed in to change notification settings - Fork 499
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
Added a log #160
Added a log #160
Conversation
@@ -30,7 +30,9 @@ function doOperation (op) { | |||
if (op === 'getItem') { | |||
try { | |||
result = JSON.parse(result) | |||
} catch (e) {} | |||
} catch (e) { | |||
console.log('LocalStorage error: Unable to parse result as json. Message: ' + e.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use debug
for logging
07ba93c
to
5a4fb8b
Compare
How does this look? |
@@ -1,4 +1,7 @@ | |||
import _ from 'lodash' | |||
import Debug from 'debug' | |||
|
|||
const debug = Debug('ipfs:utils:LocalStorage') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the convention I have in #155, i.e.
import debug from 'debug'
const log = debug('utils:localStorage')
5a4fb8b
to
177d031
Compare
Sure. I got that from /Users/richard/src/ipfs-webui/app/scripts/views/globe.js, which doesn't seem to have the same convention. Maybe we should make a styleguide? Also, there's a console.warn on the same page... |
@RichardLitt yeah that all should be fixed in #155 |
} | ||
|
||
return result | ||
} catch (e) { | ||
console.warn('LocalStorage error: ' + e.message) | ||
console.warn(e.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use debug
here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But with a warn level: const warn = debug('utils:localStorage:warn')
or sth like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
As noted by @diasdavid in ipfs#130 (comment)
177d031
to
d448dd3
Compare
LGTM :) |
As noted by @diasdavid in #130 (comment)