How to use the screwdriver-logger.error function in screwdriver-logger

To help you get started, we’ve selected a few screwdriver-logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github screwdriver-cd / screwdriver / plugins / builds / steps / logs.js View on Github external
async function getMaxLines({ baseUrl, authToken }) {
    let linesInFirstPage;

    // check lines per file by looking at the first file
    try {
        linesInFirstPage = await fetchLog({
            baseUrl,
            authToken,
            sort: 'ascending',
            linesFrom: 0,
            page: 0 });
    } catch (err) {
        logger.error(err);
        throw new Error(err);
    }

    return linesInFirstPage.length > MAX_LINES_SMALL ? MAX_LINES_BIG : MAX_LINES_SMALL;
}
github screwdriver-cd / screwdriver / plugins / builds / steps / logs.js View on Github external
async function loadLines({
    baseUrl,
    linesFrom,
    authToken,
    pagesToLoad = 10,
    sort = 'ascending',
    maxLines
}) {
    const page = Math.floor(linesFrom / maxLines);
    let morePages = false;
    let lines;

    try {
        lines = await fetchLog({ baseUrl, linesFrom, authToken, page, sort });
    } catch (err) {
        logger.error(err);
        throw new Error(err);
    }

    const linesCount = lines.length;
    const pagesToLoadUpdated = pagesToLoad - 1;
    const linesFromUpdated = sort === 'descending' ?
        linesFrom - linesCount : linesCount + linesFrom;
    // If we got lines AND there are more lines to load
    const descLoadNext = sort === 'descending' && linesCount > 0 && linesFrom - linesCount > 0;
    // If we got lines AND we reached the edge of a page
    const ascLoadNext = sort === 'ascending' && linesCount > 0
        && (linesCount + linesFrom) % maxLines === 0;

    // Load from next log if there's still lines left
    if (ascLoadNext || descLoadNext) {
        if (pagesToLoadUpdated > 0) {
github screwdriver-cd / screwdriver / plugins / webhooks / index.js View on Github external
function hasTriggeredJob(pipeline, startFrom) {
    try {
        const nextJobs = workflowParser.getNextJobs(pipeline.workflowGraph, {
            trigger: startFrom
        });

        return nextJobs.length > 0;
    } catch (err) {
        logger.error(`Error finding triggered jobs for ${pipeline.id}: ${err}`);

        return false;
    }
}
github screwdriver-cd / screwdriver / plugins / shutdown.js View on Github external
const onSigterm = async () => {
        try {
            logger.info('got SIGTERM; running triggers before shutdown');
            const res = await promiseTimeout(taskHandler(), options.terminationGracePeriod * 1000);

            if (res) {
                logger.error(res);
            }
            await gracefulStop();
        } catch (err) {
            logger.error(err);
        }
    };
github screwdriver-cd / screwdriver / lib / server.js View on Github external
                .catch(err => logger.error('Failed to start server', err));
        });
github screwdriver-cd / screwdriver / plugins / shutdown.js View on Github external
const taskHandler = async () => {
        try {
            await Promise.all(Object.keys(tasks).map(async (key) => {
                logger.info(`executing task ${key}`);
                const item = tasks[key];

                await item.task();
            }));

            return Promise.resolve();
        } catch (err) {
            logger.error(err);
            throw err;
        }
    };
github screwdriver-cd / screwdriver / plugins / webhooks / index.js View on Github external
);
        }

        const hasBuildEvents = events.filter(e => e.builds !== null);

        if (hasBuildEvents.length === 0) {
            return reply({ message: 'No jobs to start' }).code(204);
        }

        hasBuildEvents.forEach((e) => {
            request.log(['webhook', hookId, e.id], `Event ${e.id} started`);
        });

        return reply().code(201);
    } catch (err) {
        logger.error(`[${hookId}]: ${err}`);

        return reply(boom.boomify(err));
    }
}
github screwdriver-cd / screwdriver / plugins / collections / get.js View on Github external
.catch((err) => {
            logger.error(err);

            return prs;
        });
}

screwdriver-logger

Provides common logger for Screwdriver components

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis