setup-cpp/src/utils/io/io.ts

23 lines
635 B
TypeScript
Raw Normal View History

2021-09-18 21:21:22 +08:00
import * as core from "@actions/core"
import { isGitHubCI } from "../env/isci"
2021-09-18 21:21:22 +08:00
export function error(err: string | Error) {
return isGitHubCI() ? core.error(err) : console.log(`\x1b[31m${err}\x1b[0m`)
2021-09-18 21:21:22 +08:00
}
export function success(msg: string) {
return console.log(`\x1b[32m${msg}\x1b[0m`)
2021-09-18 21:21:22 +08:00
}
export function warning(msg: string) {
return isGitHubCI() ? core.warning(msg) : console.log(`\x1b[33m${msg}\x1b[0m`)
}
2022-05-03 12:38:39 +08:00
export function notice(msg: string) {
return isGitHubCI() ? core.notice(msg) : console.log(`\x1b[94m${msg}\x1b[0m`)
}
export function info(msg: string) {
return isGitHubCI() ? core.info(msg) : console.log(msg)
}