Skip to content

Commit

Permalink
[Gradle, JS] Add TeamCity simple message log4js appender
Browse files Browse the repository at this point in the history
#KT-38109 fixed
  • Loading branch information
ilgonmic committed Apr 16, 2020
1 parent 91a2541 commit 005ecc5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
22 changes: 21 additions & 1 deletion libraries/tools/kotlin-test-js-runner/src/teamcity-format.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
export function tcEscape(str: string): string
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/

export const TEST_IGNORED: string
export const SUITE_START: string
export const SUITE_END: string
export const SUITE_END_NO_DURATION: string
export const TEST_START: string
export const TEST_FAILED: string
export const TEST_FAILED_COMPARISON: string
export const TEST_END: string
export const TEST_END_NO_DURATION: string
export const BLOCK_OPENED: string
export const BLOCK_CLOSED: string
export const SIMPLE_MESSAGE: string

export function tcEscape(str: string): string

export function formatMessage(...str: string[]): string
2 changes: 2 additions & 0 deletions libraries/tools/kotlin-test-js-runner/src/teamcity-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const TEST_END_NO_DURATION = `##teamcity[testFinished name='%s' flowId='%
export const BLOCK_OPENED = `##teamcity[blockOpened name='%s' flowId='%s']`
export const BLOCK_CLOSED = `##teamcity[blockClosed name='%s' flowId='%s']`

export const SIMPLE_MESSAGE = `##teamcity[message text='%s']`

/**
* from teamcity-service-messages
* Copyright (c) 2013 Aaron Forsander
Expand Down
4 changes: 2 additions & 2 deletions libraries/tools/kotlin-test-js-runner/tc-log-appender.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

'use strict';

import {tcEscape} from "./src/teamcity-format"
import {formatMessage, SIMPLE_MESSAGE} from "./src/teamcity-format"

const consoleLog = console.log.bind(console);

function consoleAppender(layout, timezoneOffset) {
return (loggingEvent) => {
consoleLog(tcEscape(layout(loggingEvent, timezoneOffset)));
consoleLog(formatMessage(SIMPLE_MESSAGE, layout(loggingEvent, timezoneOffset)));
};
}

Expand Down

0 comments on commit 005ecc5

Please sign in to comment.