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

awesome-logging

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awesome-logging - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

1

lib/logger/logger-base.d.ts

@@ -5,2 +5,3 @@ export declare abstract class AwesomeLoggerBase {

protected _hasChanges: boolean;
fixedLineCount: number;
private _clean;

@@ -7,0 +8,0 @@ constructor(type: string);

@@ -12,2 +12,3 @@ "use strict";

this._hasChanges = true;
this.fixedLineCount = 0;
this._clean = false;

@@ -14,0 +15,0 @@ this.type = type;

6

lib/logger/logger-manager.js

@@ -104,3 +104,3 @@ "use strict";

}
const trimmedLines = string_trimmer_1.StringTrimmer.ensureConsoleFit(renderedLines, true, this._activeLogger.scrollAmount);
const trimmedLines = string_trimmer_1.StringTrimmer.ensureConsoleFit(renderedLines, true, this._activeLogger.scrollAmount, this._activeLogger.fixedLineCount);
string_renderer_1.StringRenderer.renderString(trimmedLines, false, false, false);

@@ -118,3 +118,3 @@ }

const renderedLines = logger.render();
const trimmedLines = string_trimmer_1.StringTrimmer.ensureConsoleFit(renderedLines, true, logger.scrollAmount);
const trimmedLines = string_trimmer_1.StringTrimmer.ensureConsoleFit(renderedLines, true, logger.scrollAmount, logger.fixedLineCount);
string_renderer_1.StringRenderer.renderString(trimmedLines, false, true, true);

@@ -144,3 +144,3 @@ this._activeLogger = logger;

if (activeLoggerText) {
const trimmedLines = string_trimmer_1.StringTrimmer.ensureConsoleFit(activeLoggerText, true, this._activeLogger.scrollAmount);
const trimmedLines = string_trimmer_1.StringTrimmer.ensureConsoleFit(activeLoggerText, true, this._activeLogger.scrollAmount, this._activeLogger.fixedLineCount);
string_renderer_1.StringRenderer.renderString(trimmedLines, false, false, true);

@@ -147,0 +147,0 @@ }

@@ -6,2 +6,3 @@ import { AwesomePromptChoiceConfig, AwesomePromptChoiceControl } from './config/choice';

private readonly _options;
private readonly _text?;
private readonly _lines;

@@ -8,0 +9,0 @@ constructor(config: Partial<AwesomePromptChoiceConfig>);

@@ -20,3 +20,4 @@ "use strict";

})) !== null && _b !== void 0 ? _b : [];
const multi = awesome_logger_1.AwesomeLogger.create('multi', { children: lines });
const textLogger = config.text ? new text_logger_1.AwesomeTextLogger({ text: config.text }) : undefined;
const multi = awesome_logger_1.AwesomeLogger.create('multi', { children: textLogger ? [textLogger, ...lines] : lines });
super(multi);

@@ -26,5 +27,6 @@ this._lines = lines;

this._options = (_c = config.options) !== null && _c !== void 0 ? _c : [];
this.fixedLineCount = config.text ? 1 : 0;
}
adjustLine(lineText, line, highlighted) {
const newText = `${chalk_1.default.gray(' - ')} ${(highlighted ? chalk_1.default.blue : chalk_1.default.white)(lineText)}`;
const newText = `${chalk_1.default.gray(' - ')}${(highlighted ? chalk_1.default.blue : chalk_1.default.white)(lineText)}`;
line.setText(newText);

@@ -58,3 +60,3 @@ }

this._currentHighlightedRow++;
if (this._currentHighlightedRow - this.scrollAmount > terminal_size_1.TerminalSize.terminalHeight - 2) {
if (this._currentHighlightedRow - this.scrollAmount > terminal_size_1.TerminalSize.terminalHeight - 2 - this.fixedLineCount) {
this.scrollAmount++;

@@ -61,0 +63,0 @@ }

import { AwesomePromptBaseControl } from './base';
export interface AwesomePromptChoiceConfig {
options: string[];
text?: string;
}
export interface AwesomePromptChoiceControl extends AwesomePromptBaseControl<string> {
}

@@ -12,8 +12,8 @@ "use strict";

class StringTrimmer {
static ensureConsoleFit(val, limitRowCount, scollAmount) {
static ensureConsoleFit(val, limitRowCount, scollAmount, fixedLineCount) {
const rowsTrimmed = this.ensureRowsLength(val);
const rowCount = limitRowCount ? this.ensureRowsCount(rowsTrimmed, scollAmount) : rowsTrimmed;
const rowCount = limitRowCount ? this.ensureRowsCount(rowsTrimmed, scollAmount, fixedLineCount) : rowsTrimmed;
return rowCount.join('\n');
}
static ensureRowsCount(rowsTrimmed, scrollAmount) {
static ensureRowsCount(rowsTrimmed, scrollAmount, fixedLineCount) {
const maxRowCount = terminal_size_1.TerminalSize.terminalHeight;

@@ -30,7 +30,10 @@ const actualRowCount = rowsTrimmed.length;

}
const visibleRows = rowsTrimmed.slice(scrollAmount, scrollAmount + maxRowCount);
const remainingScrollRows = maxRowCount - fixedLineCount;
const fixedRows = rowsTrimmed.splice(0, fixedLineCount);
const dynamicRows = rowsTrimmed.splice(scrollAmount, remainingScrollRows);
const visibleRows = [...fixedRows, ...dynamicRows];
const visibleRowsWithScrollPrefix = [];
for (let i = 0; i < visibleRows.length; i++) {
let visibleRow = visibleRows[i];
if (i === 0 && scrollAmount > 0) {
if (i === fixedRows.length && scrollAmount > 0) {
visibleRow = `↑ ${visibleRow}`;

@@ -41,3 +44,3 @@ }

}
else {
else if (i >= fixedRows.length) {
visibleRow = `| ${visibleRow}`;

@@ -44,0 +47,0 @@ }

@@ -92,3 +92,9 @@ "use strict";

// c.result.then(r => {});
awesome_logger_1.AwesomeLogger.prompt('confirm', { text: 'Are you really sure?' }).result.then(r => {
// AwesomeLogger.prompt('confirm', { text: 'Are you really sure?' }).result.then(r => {
// console.log(r);
// });
awesome_logger_1.AwesomeLogger.prompt('choice', {
text: 'Are you really sure?',
options: ['Option1', 'Option2', 'Option3', 'Option4', 'Option5', 'Option6', 'Option7', 'Option8', 'Option9', 'Option10']
}).result.then(r => {
console.log(r);

@@ -95,0 +101,0 @@ });

{
"name": "awesome-logging",
"version": "0.4.0",
"version": "0.5.0",
"description": "Advanced logging messages, interactive prompts, loading animations and more in TypeScript",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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