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

Added a log #160

Merged
merged 1 commit into from
Jan 3, 2016
Merged

Added a log #160

merged 1 commit into from
Jan 3, 2016

Conversation

RichardLitt
Copy link
Member

As noted by @diasdavid in #130 (comment)

@jbenet jbenet added the status/in-progress In progress label Jan 3, 2016
@@ -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)
Copy link
Member

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

@RichardLitt
Copy link
Member Author

How does this look?

@@ -1,4 +1,7 @@
import _ from 'lodash'
import Debug from 'debug'

const debug = Debug('ipfs:utils:LocalStorage')
Copy link
Member

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')

@RichardLitt
Copy link
Member Author

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...

@dignifiedquire
Copy link
Member

@RichardLitt yeah that all should be fixed in #155

}

return result
} catch (e) {
console.warn('LocalStorage error: ' + e.message)
console.warn(e.message)
Copy link
Member

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

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dignifiedquire
Copy link
Member

LGTM :)

dignifiedquire added a commit that referenced this pull request Jan 3, 2016
@dignifiedquire dignifiedquire merged commit d8024c6 into ipfs:master Jan 3, 2016
@jbenet jbenet removed the status/in-progress In progress label Jan 3, 2016
@RichardLitt RichardLitt deleted the feature/add-log branch January 3, 2016 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants