Console log helpers for your debugging journey
Getting Started
Install
npm install tacker -S
Add to source
import { printLine, printMirror, printPkgVersion, printPkgProp } from "tacker";
API
<summary>
printLine(szColor || oColor)
- Sync </summary>
Where
- szColor is a string. Color options can be found on chalk's readme or in source here
- oColor is an object comprised of properties so you can mnaually configure the line
color
: the color of the line; default is bluecharacter
: the character which will make up the line; default is -length
: represents the number of characters to repeat; default is 59quantity
represents the number of lines to print; default is 1
Examples
-
printLine("blue")
-
printLine({color:"blue", character:"-","length:59",quantity:1})
Output
Both of the above examples produce this identical output
<summary>
printMirror({ mVariable }, szKeyColor, szValueColor)
- Sync</summary>
This will print the variable's name and the variable's value (regardless of variable type).
Where
- mVariable is an object or a variable you would like to print. If it's an object or an array, it will pretty-print using JSON.stringify.
- szVariableKeyColor is a string of the variable's key.
- szVariableValueColor is an object or a variable
Example
const mock = {
foo: "bar"
};
printMirror({mock}, "blue", "grey")
Output

<summary>
This will print the version of the specified package.
printPkgVersion(mPkgSource)
- Async</summary>
This will print the version of the specified package.
Where
- mPkgSource allows you to specify which package to read from.
-
undefined
-
string
-
object
-
Example
await printPkgVersion()
await printPkgVersion("/path")
await printPkgVersion("/path/package.json")
await printPkgVersion({ name: "tacker", version: "x.y.z", ...})
Output

<summary>
printPkgProp(szProperty, mPkgSource)
- Async</summary>
This will print any property from the specified package.
Where
- szProperty allows you to specify the package property.
- mPkgSource allows you to specify which package to read from.
-
undefined
-
string
-
object
-
Example
await printPkgProp("version")
await printPkgProp("version", "/path")
await printPkgProp("version", "/path/package.json")
await printPkgProp("version", { name: "tacker", version: "x.y.z", ...})
Output

FAQ
<summary>Name</summary>
Portmaneau of "tack" and "logger"
In a sailing context, tack means "change course by turning a boat's head into and through the wind"
<summary>Why</summary>There's reasons to use more sophisticated tooling (stack traces, Chrome dev tools, etc). However, when you're getting up-and-running with a project, it's extremely helpful to be able to log values. The issue is before long, your terminal is contaminated with a slew of logs. Tacker exists to solve this
<summary>How</summary>
- Make logs prettier (current)
- Only log things in certain circumstances (future)