marinanekrassova / smartsafe

1 stars 0 forks source link

Logging for client application #53

Closed lasertunguus closed 7 years ago

lasertunguus commented 7 years ago

For better debugging we should use logging in our JS application. A good and intuitive to use seems to be winstonjs/winston.

Logging levels (currently set to debug, adjustable in utils/log.js): { error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }

Usage:

  1. use code below to use this logger: var logger = require('winston') entrypoint js-file needs to have (index.js/server.js): var logger = require('')
  2. log with logger.<error|warn|info|debug>('...') supports string interpolation as in var t = 'test' logger.info('%s test', t) => test test

No need to go crazy on this, just when it seems necessary or would be useful for debugging.

peterjasc commented 7 years ago

@lasertunguus console.log.bind(console) should be good enough. Don't overthink it.

lasertunguus commented 7 years ago

Closing for now. Before sending to UAT, file logging should be added.