New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cllc

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cllc - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

12

index.js

@@ -21,3 +21,3 @@ const strftime = require('strftime');

.split(/%s/)
.map((v, i) => v + (_i[i] ? chalk.white(_i[i]) : ''))
.map((v, i) => v + (i === _i.length ? '' : chalk.white(_i[i])))
.join('');

@@ -72,5 +72,6 @@

_text = text;
const tl = _text.split(/%s/).length - 1 || 1;
args = args.length ? args.map(v => +v || 0) : [1];
_i = Object.assign(Array(tl).fill(0), args.slice(0, tl));
const tl = _text.split(/%s/).length - 1;
const zeros = Array(tl).fill(0);
args = args.length ? args.map(v => +v || 0) : zeros;
_i = Object.assign(zeros, args.slice(0, tl));
lU.show();

@@ -102,3 +103,6 @@ };

log.counters = () => _i.slice();
log.text = () => _text;
return log;
};
{
"name": "cllc",
"version": "0.0.15",
"version": "0.0.16",
"description": "Simple logger and counter fore console",

@@ -5,0 +5,0 @@ "main": "index.js",

# cllc
Simple logger and counter for console
`C`ommand `L`ine `L`ogger and `C`ounter
There is a logger and counter two-in-one. And log messages do not erase counter text. Perfect for work process indication in long-time scripts.
[![NPM version][npm-image]][npm-url]

@@ -15,4 +17,2 @@

There is a logger and counter two-in-one. And log messages do not erase counter string. Perfect for work process indication in long-time scripts.
### Logger

@@ -23,3 +23,3 @@

```js
var log = require('cllc')();
const log = require('cllc')();

@@ -72,3 +72,3 @@ log('Sample message');

```js
var log = require('cllc')('TAG1');
const log = require('cllc')('TAG1');
log('log string with tag "TAG1"');

@@ -84,3 +84,3 @@ log.tag('Tag2');

```js
var log = require('cllc')(module);
const log = require('cllc')(module);
log('log string with something like "my-module/index" in tag');

@@ -101,7 +101,8 @@ ```

Counter is a last string on console, where digital value in string are incrementing step by step. If counter are visible - log strings appears on second string from bottom.
Counter is a text in the end of console, contains digital value(s) that are incrementing step by step.
#### Start counter
```js
// Start counter
log.start();
log.start(); //same as log.start('%s');
// //or//

@@ -111,5 +112,8 @@ // log.start('%s tasks done.', 0);

// log.start('%s foo, %s bar, %s baz', 0, 1, 2);
```
// Increment counter
log.step();
#### Increment counter
```js
log.step(); // same as step(1);
// //or//

@@ -119,16 +123,44 @@ // log.step(5);

// log.step(0, 0, 1);
```
// Safe logger
log('TEST');
#### Stop counter
// Stop counter
```js
log.stop(); // stop and clear
// //or//
// log.finish(); // stop and save last string
// log.finish(); // stop and save counter text
// //or//
// log.finish('Well done %s tasks!', 100); // stop with special string
// log.finish('Well done %s tasks!', 100); // stop with special text
// //or//
// log.finish('%s foo, %s bar, %s baz', 100, 200, 300); // stop with special string
// log.finish('%s foo, %s bar, %s baz', 100, 200, 300); // stop with special text
```
#### Restart/change counter
Calling `log.start` starting new counter with new text and new values. If another counter was active on that moment it will be destroyed silently (if you want save it - call `log.finish` before start next counter).
Current counter text and values are availiable via `log.text` and `log.counters` functions.
```js
log.start('First counter [%s][%s]', 1, 5);
// do something like `log.step` here
// then:
log start(doSomething(log.text()), ...doSomethingElse(log.counters()));
```
#### Safe logger
If counter are visible - log strings appear on string above counter text and will not be erased by counter. So use `log` from `cllc` instead `console.log` when counter active.
```js
log.start('[%s]');
log.step();
log('TEST');
log.finish();
// result output
// TEST
// [0]
```
## License

@@ -135,0 +167,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc