mozilla / fxa-auth-server

DEPRECATED - Migrated to https://github.com/mozilla/fxa
Mozilla Public License 2.0
399 stars 121 forks source link

Log using a mozlog-compatible interface #2940

Closed shane-tomlinson closed 5 years ago

shane-tomlinson commented 5 years ago

Similar to https://github.com/mozilla/fxa-customs-server/issues/322

This repo writes directly to stderr w/o using mozlog 2.0, which is different than other fxa servers. This can cause confusion with questions like "why does this server write an object with an op whereas other repos call the log method with the op as the first argument and then an object?" Or at least, that's what I asked. What's doubly confusing is the code under the fxa-oauth-server uses mozlog, the auth-server code does not.

Maybe shared server side logging should be part of fxa-shared so we can reduce confusion.

farhan787 commented 5 years ago

@shane-tomlinson may I fix this ?

philbooth commented 5 years ago

Correction to this bug, lib/log.js does use mozlog internally, just the interface it exposes is different. If we decide that is a problem for us, we can change the signature of its methods and all the method calls so that they take op as the first argument instead of a property.

shane-tomlinson commented 5 years ago

Using VSCode regexp replacement, I was able to do the replacements using regular expressions:

log.([^)]+)\({\n?\s*op: '([^']+)', => log.$1('$2', {

I suspect the tests are going to take some grunt work.