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

Feature request: support printf-like formatting #20

Closed
pvdlg opened this issue May 26, 2018 · 0 comments
Closed

Feature request: support printf-like formatting #20

pvdlg opened this issue May 26, 2018 · 0 comments
Labels
feature request Request for a new feature

Comments

@pvdlg
Copy link

pvdlg commented May 26, 2018

Is your feature request related to a problem? Please describe.
Cannot be used directly as a placement of the console object as string formatting is not supported:

console.log('Operation %s successful', 'xyz');
// => Operation xyz successful

const signale = require('signale');
signale.success('Operation %s successful', 'xyz');
// => ✔  success   Operation %s successful xyz

In this example %s is not replaced by the following arguments like it's with console.log.

Describe the solution you'd like
Add printf-like formatting for strings passed to any logger. Strings can be formatted with util.format().

Additionally the replaced values could be highlighted with a color specific to each logger. For example signale.success('Operation %s successful', 'xyz'); could write ✔ success Operation xyz successful with xyz in green as it is the color associated with the success logger.

Additional context
Possible implementation to use:

@klaudiosinani klaudiosinani added the feature request Request for a new feature label May 27, 2018
klaudiosinani pushed a commit that referenced this issue Jun 9, 2018
* feat(): support printf-like formatting

* fix(test): removed one code comment

* fix(#24): Print stringified and colorized objects

* refactor: requested changes done but except message destructuring

* fix: message destructuring and changed const to let for assign args in message when message undefined

* fix: lint error

* refactor: simplify to a one-liner

* fix: tslint error and changed let to const

* fix: checked suffux and prefix exists or not by func

* refactor
klaudiosinani pushed a commit that referenced this issue Jun 9, 2018
* feat(): support printf-like formatting

* fix(test): removed one code comment

* fix(#24): Print stringified and colorized objects

* refactor: requested changes done but except message destructuring

* fix: message destructuring and changed const to let for assign args in message when message undefined

* fix: lint error

* refactor: simplify to a one-liner

* fix: tslint error and changed let to const

* fix: checked suffux and prefix exists or not by func

* refactor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants