@tormozz48/azure-pipelines-logger
v1.0.0
Published
Useful logger for scripts which run in azure pipelines
Downloads
8
Maintainers
Readme
azure-pipelines-logger
Useful logger for scripts which runs in azure pipelines. Allows to use internal pipeline formatters for log messages.
Install and Usage
Install package from npm:
npm i @tormozz48/azure-pipelines-logger
Include logger into code:
import {Logger} from '@tormozz48/azure-pipelines-logger';
const logger = new Logger({});
logger.beginGroup('Log messages group');
logger.debug('Some debug message');
logger.info('Some info message');
logger.warn('Some warning message');
logger.error('Some error message');
logger.startSection('Start my awesome section');
logger.runCommand('Run my awesome command');
logger.endGroup();
logger.completeSuccess('Success completion');
Code above will generate something similar to this
Advanced usage
Complete: Finish Timeline
Related documentation
import {Logger} from '@tormozz48/azure-pipelines-logger';
const logger = new Logger({});
// successfull build
logger.completeSuccess('Success completion');
// build with warnings
logger.completeWarning('Compeleted with warnings');
// build with errors
logger.completeError('Compeleted with error');
LogIssue: Log an error or warning
Related documentation
const logger = new Logger({});
// warning issue
logger.logIssueWarning('Some warning issue');
// error issue
logger.logIssueError('Some error issue');
Include time into log message
const logger = new Logger({showDate: true});
logger.debug('Hello World') // ##[debug] 15:04:28 Hello World
Another datetime format can be set via dateFormat
option:
const logger = new Logger({
showDate: true,
dateFormat: 'fullDate'
});
logger.debug('Hello World') // ##[debug] Saturday, June 9, 2007 Hello World
Develop
Useful dev scripts:
npm run build
- compile typescript codenpm run lint
- check code syntax via eslintnpm test
- run tests with jestnpm run docs
- creates API documentation with typedoc
Maintainer: Andrey Kuznetsov