homelab/services/parts-inventory/api/node_modules/ts-node-dev/lib/log.js
Dan V deb6c38d7b chore: commit homelab setup — deployment, services, orchestration, skill
- Add .gitignore: exclude compiled binaries, build artifacts, and Helm
  values files containing real secrets (authentik, prometheus)
- Add all Kubernetes deployment manifests (deployment/)
- Add services source code: ha-sync, device-inventory, games-console,
  paperclip, parts-inventory
- Add Ansible orchestration: playbooks, roles, inventory, cloud-init
- Add hardware specs, execution plans, scripts, HOMELAB.md
- Add skills/homelab/SKILL.md + skills/install.sh to preserve Copilot skill
- Remove previously-tracked inventory-cli binary from git index

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-09 08:10:32 +02:00

50 lines
1.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeLog = void 0;
var util = require('util');
var colors = {
info: '36',
error: '31;1',
warn: '33',
debug: '90',
};
var formatDate = function (date) {
return [date.getHours(), date.getMinutes(), date.getSeconds()]
.map(function (n) { return n.toString().padStart(2, '0'); })
.join(':');
};
/**
* Logs a message to the console. The level is displayed in ANSI colors,
* either bright red in case of an error or green otherwise.
*/
exports.makeLog = function (cfg) {
function log(msg, level) {
if (cfg.quiet && level === 'info')
return;
if (cfg.timestamp)
msg = color(formatDate(new Date()), '30;1') + ' ' + msg;
var c = colors[level.toLowerCase()] || '32';
console.log('[' + color(level.toUpperCase(), c) + '] ' + msg);
}
function color(s, c) {
if (process.stdout.isTTY) {
return '\x1B[' + c + 'm' + s + '\x1B[0m';
}
return s;
}
log.debug = function () {
if (!cfg.debug)
return;
log(util.format.apply(util, arguments), 'debug');
};
log.info = function () {
log(util.format.apply(util, arguments), 'info');
};
log.warn = function () {
log(util.format.apply(util, arguments), 'warn');
};
log.error = function () {
log(util.format.apply(util, arguments), 'error');
};
return log;
};