Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
d1c05fb9ae | |||
f81971d148 | |||
aa6a27970a | |||
b31d9f0c36 | |||
e6cef68a26 | |||
aa327efeac | |||
7cbc64ed8d | |||
2c49ef49c2 | |||
823784e6b6 | |||
a98f48409d |
29
changelog.md
29
changelog.md
@ -1,5 +1,34 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-05-20 - 3.1.8 - fix(devDependencies)
|
||||||
|
Update devDependencies for tstest and Node types
|
||||||
|
|
||||||
|
- Bump @git.zone/tstest from ^1.7.0 to ^1.9.0
|
||||||
|
- Bump @types/node from ^22.15.18 to ^22.15.20
|
||||||
|
|
||||||
|
## 2025-05-20 - 3.1.7 - fix(ts_destination_local)
|
||||||
|
Update debug log color: set textColor to 'pink' in DestinationLocal.
|
||||||
|
|
||||||
|
- Changed debug log text color from 'gray' to 'pink' for improved consistency in log output
|
||||||
|
|
||||||
|
## 2025-05-20 - 3.1.6 - fix(ts_destination_local)
|
||||||
|
Update debug prefix color in DestinationLocal: change from gray to pink for improved visibility.
|
||||||
|
|
||||||
|
- Adjusted the 'debug' log prefix color in classes.destinationlocal.ts to use 'pink' instead of 'gray'.
|
||||||
|
|
||||||
|
## 2025-05-20 - 3.1.5 - fix(core)
|
||||||
|
Maintain and verify project metadata and commit info consistency
|
||||||
|
|
||||||
|
- No code changes; confirming commit info files and documentation remain aligned
|
||||||
|
- Ensured consistent versioning across submodules and package metadata
|
||||||
|
|
||||||
|
## 2025-05-20 - 3.1.4 - fix(DestinationLocal)
|
||||||
|
Fix debug log rendering, add fallback for unknown log levels, and correct error prefix typo in local destination
|
||||||
|
|
||||||
|
- Added tests for debug and unknown log levels in DestinationLocal
|
||||||
|
- Refactored log string generation to use a fallback style for undefined levels
|
||||||
|
- Fixed typo: replaced non-existent 'errorPrefix' with 'error.prefix'
|
||||||
|
|
||||||
## 2025-05-19 - 3.1.3 - fix(documentation)
|
## 2025-05-19 - 3.1.3 - fix(documentation)
|
||||||
Update API reference and enhance README with detailed examples and usage instructions
|
Update API reference and enhance README with detailed examples and usage instructions
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartlog",
|
"name": "@push.rocks/smartlog",
|
||||||
"version": "3.1.3",
|
"version": "3.1.8",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A minimalistic, distributed, and extensible logging tool supporting centralized log management.",
|
"description": "A minimalistic, distributed, and extensible logging tool supporting centralized log management.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -45,8 +45,8 @@
|
|||||||
"@git.zone/tsbuild": "^2.5.1",
|
"@git.zone/tsbuild": "^2.5.1",
|
||||||
"@git.zone/tsbundle": "^2.2.5",
|
"@git.zone/tsbundle": "^2.2.5",
|
||||||
"@git.zone/tsrun": "^1.3.3",
|
"@git.zone/tsrun": "^1.3.3",
|
||||||
"@git.zone/tstest": "^1.7.0",
|
"@git.zone/tstest": "^1.9.0",
|
||||||
"@types/node": "^22.15.18"
|
"@types/node": "^22.15.20"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@api.global/typedrequest-interfaces": "^3.0.19",
|
"@api.global/typedrequest-interfaces": "^3.0.19",
|
||||||
|
964
pnpm-lock.yaml
generated
964
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -92,5 +92,23 @@ tap.test('should create new line(s)', async () => {
|
|||||||
// Multiple lines
|
// Multiple lines
|
||||||
testDestination.newLine(3);
|
testDestination.newLine(3);
|
||||||
});
|
});
|
||||||
|
// Test debug level rendering and fallback for unknown levels
|
||||||
|
tap.test('should handle debug and unknown log levels', async () => {
|
||||||
|
testDestination = new DestinationLocal();
|
||||||
|
let out = '';
|
||||||
|
const originalLog = console.log;
|
||||||
|
console.log = (msg: string) => { out += msg; };
|
||||||
|
|
||||||
|
// debug level should render message correctly
|
||||||
|
await testDestination.handleLog(createMockLogPackage('debug', 'debug 🎉'));
|
||||||
|
expect(out).toContain('debug 🎉');
|
||||||
|
|
||||||
|
// fallback for unknown level should still render message
|
||||||
|
out = '';
|
||||||
|
await testDestination.handleLog(createMockLogPackage('verbose' as any, 'verbose ⚠️'));
|
||||||
|
expect(out).toContain('verbose ⚠️');
|
||||||
|
|
||||||
|
console.log = originalLog;
|
||||||
|
});
|
||||||
|
|
||||||
export default tap.start();
|
export default tap.start();
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartlog',
|
name: '@push.rocks/smartlog',
|
||||||
version: '3.1.3',
|
version: '3.1.8',
|
||||||
description: 'A minimalistic, distributed, and extensible logging tool supporting centralized log management.'
|
description: 'A minimalistic, distributed, and extensible logging tool supporting centralized log management.'
|
||||||
}
|
}
|
||||||
|
@ -61,19 +61,22 @@ export class DestinationLocal implements ILogDestination {
|
|||||||
|
|
||||||
// default logging
|
// default logging
|
||||||
private logToConsole(logPackageArg: ILogPackage) {
|
private logToConsole(logPackageArg: ILogPackage) {
|
||||||
let logString: string;
|
|
||||||
try {
|
try {
|
||||||
logString =
|
const style = this.localBl[logPackageArg.level] ?? this.localBl.info;
|
||||||
this.localBl[logPackageArg.level].prefix +
|
const logString =
|
||||||
|
style.prefix +
|
||||||
plugins.consolecolor.coloredString(
|
plugins.consolecolor.coloredString(
|
||||||
logPackageArg.message,
|
logPackageArg.message,
|
||||||
this.localBl[logPackageArg.level].textColor
|
style.textColor
|
||||||
);
|
);
|
||||||
console.log(logString);
|
console.log(logString);
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// typo fix: use the defined error.prefix, not a non-existent errorPrefix
|
||||||
console.log(
|
console.log(
|
||||||
this.localBl.errorPrefix + 'You seem to have tried logging something strange' + error
|
this.localBl.error.prefix +
|
||||||
|
'You seem to have tried logging something strange ' +
|
||||||
|
error
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -89,6 +92,10 @@ export class DestinationLocal implements ILogDestination {
|
|||||||
prefix: plugins.consolecolor.coloredString(' silly ', 'white', 'blue') + ' ',
|
prefix: plugins.consolecolor.coloredString(' silly ', 'white', 'blue') + ' ',
|
||||||
textColor: 'blue',
|
textColor: 'blue',
|
||||||
},
|
},
|
||||||
|
debug: {
|
||||||
|
prefix: plugins.consolecolor.coloredString(' debug ', 'pink', 'black') + ' ',
|
||||||
|
textColor: 'pink',
|
||||||
|
},
|
||||||
error: {
|
error: {
|
||||||
prefix:
|
prefix:
|
||||||
plugins.consolecolor.coloredString(' ', 'red', 'red') +
|
plugins.consolecolor.coloredString(' ', 'red', 'red') +
|
||||||
|
Reference in New Issue
Block a user