-
Notifications
You must be signed in to change notification settings - Fork 616
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
Improve error handling and logging #531
Comments
You mean to build a wrapper of I used Minilog a couple of times and liked the API and flexibility. Supports several verbosity levels and output streams. Works on browsers and server-side, but have no Component support. |
Hey guys, I added a question to gtter, I think here is a good place to add the same question cause the log in this case is not informative: I am trying to install DemocracyOS on my ubuntu, I get the following error while running make: error : "no remote found for dependency "component/dropdown@7207a". run component open troubleshooting for help." any idea? |
@alejandro-uliski that's just an error with the build in your environment; nothing to do with |
@alejandro-uliski please refer to this link on our wiki pages |
@gvilarino I did this wrapper for another project: import debug from 'debug'
import config from './config'
let base = 'democracyos'
let logLevels = [
'critical',
'error',
'warn',
'info',
'debug',
]
let logLevel = logLevels.indexOf(config.DEBUG)
if (logLevel > -1) {
let scope = logLevels.slice(0, logLevel + 1)
.map(l => `${base}:${l},${base}:${l}:*`)
.join(',')
debug.enable(scope)
} else if (config.DEBUG === '*') {
debug.enable(`${base}:*`)
} else if (config.DEBUG) {
debug.enable(config.DEBUG)
}
export default class Log {
constructor (scope) {
logLevels.forEach(level => {
let baseScope = `${base}:${level}`
if (scope) baseScope += `:${scope}`
this[level] = debug(baseScope)
})
}
} The idea is to let you log on different leves ( Without scope: import Log from 'lib/log'
let log = new Log()
log.critical('Everything is broken, ahahahahah!')
log.warn('A message that will never be read.')
log.debug('Debugging message') will print:
Scoped example: import Log from 'lib/log'
let log = new Log('article:show')
log.critical('Everything is broken in this scope, ahahahahah!') will print:
|
@mjlescano that's sort of what I have in mind. I'd like to build it on top of |
Here's a better lib. We can make it configurable to print to |
We must find a better way to log and handle errors; especially on the backend.
We're currently using
debug
and we just log stuff, but it might be cool to have some stuff shown through logged tostderr
, and to be shown differently (i.e.: more visibly) when something goes wrong.debug
supports that (in a way) but you need to set that up whenever you require it.I think we could wrap
debug
under alog
util and provide a more comfortable api.Another approach would be to mimic what notifier does, even if we don't make it rely on
logentries
.Actually this could be a good thing to make into a module/component under DemocracyOS and have all our repos use that.
Thoughts?
The text was updated successfully, but these errors were encountered: