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

rethink signature of SimpleInterface.info() and make fields optional first argument #73

Open
tripodsan opened this issue Nov 22, 2019 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@tripodsan
Copy link
Contributor

Is your feature request related to a problem? Please describe.

the current signature of the SimpleInterface logging methods are:

info(string: message)
infoFields(string: message, object: fields)

It would be more aligned with the bunyan logger, and would allow for potential string interpolation, if the signature would be:

info(string: message)
info(object: fields, string:message) // overload

Describe the solution you'd like
create a breaking change and:

  • remove the SimpleInterface.*Fields() methods
  • change the signature so that the first argument is either a fields object or a string message.
@tripodsan tripodsan added the enhancement New feature or request label Nov 22, 2019
@koraa koraa added the question Further information is requested label Nov 22, 2019
@koraa
Copy link
Contributor

koraa commented Nov 22, 2019

the current signature of the SimpleInterface logging methods are:

info(string: message)
infoFields(string: message, object: fields)

Thatis not quite correct; the signature is:

info(...any)
infoFields(...any, object: fields)

In this way they are very similar to console.log; an overload as you are suggesting would be ambiguous:

info(...any)
info(...any, object: fields) // could also match the first overload

I agree that the Fields methods are not pretty, but they are unambiguous…
Although I do agree finding a better interface would be great, so if we can find a better interface that preserves the console.log like functionality while staying unambiguous…that would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants