UNPKG

azure-pipelines-logging

Version:
16 lines (15 loc) 663 B
import flatMap from "array.prototype.flatmap"; import { serializeProperties, } from "./internal/command"; export function command(area, action, ...properties) { const propsString = properties.length === 0 ? "" : serializeProperties(properties[0]); const maybeSpace = propsString.length === 0 ? "" : " "; return message => `##vso[${area}.${action}${maybeSpace}${propsString}]${message}`; } export function format(format) { return (...message) => ((message.length === 0 ? [""] : flatMap(message, arg => arg.split("\n"))) .map(line => `##[${format}]${line}`) .join("\n")); } export function log(message) { console.log(message); }