How to use the @atomist/automation-client.logger.debug function in @atomist/automation-client

To help you get started, we’ve selected a few @atomist/automation-client 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 atomist / sdm-pack-spring / lib / spring / generate / SpringBootProjectStructure.ts View on Github external
pathExpression: string | PathExpression): Promise {
        const fileHits = await astUtils.findFileMatches(p, parserOrRegistry, globOptions, pathExpression);
        const matches: SpringBootProjectStructure[] = [];

        for (const fh of fileHits) {
            // It's in the default package if no match found
            const packageName: { name: string } = {
                name: fh.file.extension === "java" ?
                    // TODO using package workaround for Antlr bug
                    ((await packageInfo(p, fh.file.path)) || { fqn: "" }).fqn :
                    evaluateScalarValue(fh.fileNode, KotlinPackage) ||
                    "",
            };
            const appClass = fh.matches[0].$value;
            if (packageName && appClass) {
                logger.debug("Successful Spring Boot inference on %j: packageName '%s', '%s'",
                    p.id, packageName.name, appClass);
                matches.push(new SpringBootProjectStructure(packageName.name, appClass, fh.file));
            } else {
                logger.debug("Unsuccessful Spring Boot inference on %j: packageName '%j', '%s'",
                    p.id, packageName, appClass);
            }
        }
        return matches;
    }
github atomist / sdm-pack-spring / lib / spring / generate / SpringBootProjectStructure.ts View on Github external
for (const fh of fileHits) {
            // It's in the default package if no match found
            const packageName: { name: string } = {
                name: fh.file.extension === "java" ?
                    // TODO using package workaround for Antlr bug
                    ((await packageInfo(p, fh.file.path)) || { fqn: "" }).fqn :
                    evaluateScalarValue(fh.fileNode, KotlinPackage) ||
                    "",
            };
            const appClass = fh.matches[0].$value;
            if (packageName && appClass) {
                logger.debug("Successful Spring Boot inference on %j: packageName '%s', '%s'",
                    p.id, packageName.name, appClass);
                matches.push(new SpringBootProjectStructure(packageName.name, appClass, fh.file));
            } else {
                logger.debug("Unsuccessful Spring Boot inference on %j: packageName '%j', '%s'",
                    p.id, packageName, appClass);
            }
        }
        return matches;
    }
github atomist / sdm / src / common / listener / support / pushtest / jvm / materialChangeToJavaRepo.ts View on Github external
export const MaterialChangeToJavaRepo = pushTest("Material change to Java repo", async pci => {
    const beforeSha: string = _.get(pci, "push.before.sha");
    const changedFiles = await filesChangedSince(pci.project, beforeSha);
    if (!changedFiles) {
        logger.info("Cannot determine if change is material on %j: can't enumerate changed files", pci.id);
        return true;
    }
    logger.debug(`MaterialChangeToJavaRepo: Changed files are [${changedFiles.join(",")}]`);
    if (anyFileChangedWithExtension(changedFiles, FileToWatch)) {
        logger.debug("Change is material on %j: changed files=[%s]", pci.id, changedFiles.join(","));
        return true;
    }
    logger.debug("Change is immaterial on %j: changed files=[%s]", pci.id, changedFiles.join(","));
    return false;
});
github atomist / sdm-core / lib / log / RolarProgressLog.ts View on Github external
content: postingLogs || [],
                    },
                    headers: { "Content-Type": "application/json" },
                    retry: {
                        retries: 0,
                    },
                    options: {
                        timeout: 2500,
                    },
                });
            } catch (err) {
                this.localLogs = postingLogs.concat(this.localLogs);
                if (!/timeout.*exceeded/i.test(err.message)) {
                    logger.error(err.message);
                } else {
                    logger.debug("Calling rolar timed out");
                }
            }
            return result;
        }
        return Promise.resolve();
    }
github atomist / sdm / lib / api-helper / code / review / patternMatchReviewer.ts View on Github external
inspection: async (project, cri) => {
            logger.debug("Running regexp review '%s' on %s against %j", name, opts.globPattern, antiPatterns);
            const result: ProjectReview = {repoId: project.id, comments: []};
            await projectUtils.doWithFiles(project, opts.globPattern, async f => {
                const content = await f.getContent();
                antiPatterns.forEach(problem => {
                    const rex = typeof problem.antiPattern === "string" ?
                        new RegExp(_.escapeRegExp(problem.antiPattern)) :
                        problem.antiPattern;
                    if (rex.test(content)) {
                        logger.debug("%s: Antipattern %s found in %s", name, problem.antiPattern, f.path);
                        result.comments.push({
                            severity: opts.severity || "error",
                            detail: problem.comment,
                            category: opts.category || name,
                            subcategory: opts.subcategory,
                            sourceLocation: {
                                path: f.path,
github atomist / sdm-core / lib / pack / goal-state / manageGoalSets.ts View on Github external
const gs = (await ctx.graphClient.query({
        name: "InProcessSdmGoals",
        variables: {
            registration: [sdm.configuration.name],
        },
        options: {
            ...QueryNoCacheOptions,
            log: configurationValue("sdm.query.logging", false),
        },
    })).SdmGoal;

    const state = !!options && !!options.state ? options.state : SdmGoalState.canceled;

    for (const goal of gs) {
        if (goal.ts < end) {
            logger.debug(
                `Canceling goal '${goal.uniqueName}' of goal set '${goal.goalSetId}' because it timed out after '${formatDuration(timeout)}'`);
            let description = `${state === SdmGoalState.canceled ? "Canceled" : "Failed"}: ${goal.name}`;
            if (!!goal.descriptions) {
                if (state === SdmGoalState.canceled && !!goal.descriptions.canceled) {
                    description = goal.descriptions.canceled;
                } else if (state === SdmGoalState.failure && !!goal.descriptions.failed) {
                    description = goal.descriptions.failed;
                }
            }
            await updateGoal(
                ctx,
                goal as any,
                {
                    state,
                    description,
                    phase: `${formatDuration(timeout)} timeout`,
github atomist / sdm-core / lib / pack / k8s / config.ts View on Github external
export function loadKubeClusterConfig(): k8s.KubeConfig {
    const kc = new k8s.KubeConfig();
    try {
        kc.loadFromCluster();
    } catch (e) {
        logger.debug("Failed to to load in-cluster config, attempting default");
        try {
            kc.loadFromDefault();
        } catch (ex) {
            logger.debug("Failed to to load default config");
        }
    }
    return kc;
}
github atomist / sdm-core / lib / handlers / events / delivery / goals / goalExecution.ts View on Github external
public async send(msg: any, destinations: Destination | Destination[], options?: MessageOptions): Promise {
        logger.debug(`Ignoring send message '${JSON.stringify(msg)}'`);
    }
}
github atomist / sdm / lib / api-helper / misc / reportFailureInterpretation.ts View on Github external
export async function reportFailureInterpretation(stepName: string,
                                                  interpretation: InterpretedLog | undefined,
                                                  fullLog: { url?: string, log: string },
                                                  id: RemoteRepoRef,
                                                  addressChannels: AddressChannels,
                                                  retryButton?: slack.Action): Promise {
    if (!interpretation) {
        if (fullLog.url) {
            logger.debug("No log interpretation. Log available at: " + fullLog.url);
            return;
        }
        logger.debug("No log interpretation, no log URL. Sending full log to Slack");
        await addressChannels({
            content: fullLog.log,
            fileType: "text",
            fileName: `${stepName}-failure-${id.sha}.log`,
        } as any);
        return;
    }
    await addressChannels({
        text: `Failed ${stepName} of ${slack.url(`${id.url}/tree/${id.sha}`, id.sha.substr(0, 7))}`,
        attachments: [{
            title: interpretation.message || "Failure",
            title_link: fullLog.url,
            fallback: "relevant bits",
            text: interpretation.relevantPart,
            color: "#ff5050",
            actions: retryButton ? [retryButton] : [],