Kind Regards,
... is the CLI output resulting from the following:
import { Reporter } from "kind-regards";
import { join } from "path";
const report = Reporter({
verbose: true,
debug: true,
documentation: join(__dirname, "DIAGNOSTICS.md"),
});
report.diagnostic({
category: "warning",
message: "Warning Log",
file: __filename,
});
report.diagnostic({
category: "error",
message: "Recoverable error log",
file: __filename,
recoverable: true,
});
report.info("Info log");
report.verbose("Verbose-mode only log");
report.success("Success log");
const a = {
b: {
c: {
d: () => console.log("e"),
},
},
};
// @ts-ignore
a.b.c.f = a;
report.debug(a);
report.diagnostic({
category: "error",
message: "Unrecoverable error log",
file: __filename,
});
Why?
Because it's kind to...
- be concise when displaying varying kinds of logs to users.
- offer users
silent
,verbose
, anddebug
modes. - offer serialization, highlighting, and pretty-printing data (circularities included).
Between warnings, errors, one-off console logs, verbose/debug-mode logs, circular-object printing, and their related documentation... there's a lot of complexity to manage. kind-regards
takes care of this complexity.
Installation
npm i kind-regards
Instantiation
import { Reporter } from "kind-regards";
const report = Reporter();
Configuration Options
Reporter
accepts an optional object with the following properties:
Key | Type | Default | Description |
---|---|---|---|
documentation |
`string | Falsy` | undefined |
silent |
`boolean | Falsy` | undefined |
verbose |
`boolean | Falsy` | undefined |
debug |
`boolean | Falsy` | undefined |
For instance...
import { Reporter } from "kind-regards";
import { join } from "path";
const report = Reporter({
verbose: true,
debug: true,
documentation: join(__dirname, "../README.md"),
});
make sure––when publishing––to include the referenced documentation in your package
Methods
... look at the type definitions ;)