27 lines
807 B
TypeScript
27 lines
807 B
TypeScript
import * as plugins from './tsdocker.plugins.js';
|
|
|
|
export const logger = new plugins.smartlog.Smartlog({
|
|
logContext: {
|
|
company: 'Some Company',
|
|
companyunit: 'Some CompanyUnit',
|
|
containerName: 'Some Containername',
|
|
environment: 'local',
|
|
runtime: 'node',
|
|
zone: 'gitzone'
|
|
},
|
|
minimumLogLevel: 'silly'
|
|
});
|
|
|
|
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
|
|
|
export const ora = new plugins.smartlogSouceOra.SmartlogSourceOra();
|
|
|
|
export function formatDuration(ms: number): string {
|
|
if (ms < 1000) return `${ms}ms`;
|
|
const totalSeconds = ms / 1000;
|
|
if (totalSeconds < 60) return `${totalSeconds.toFixed(1)}s`;
|
|
const minutes = Math.floor(totalSeconds / 60);
|
|
const seconds = Math.round(totalSeconds % 60);
|
|
return `${minutes}m ${seconds}s`;
|
|
}
|