-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
65 lines (61 loc) · 1.78 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const msTeamsWinston = require("./index.js");
const { createLogger } = require('winston');
const hookUri = process.env.HOOK_URI;// Set this to the URI of your Microsoft Teams Webhook URI
const msTeamsWinstonOptions = {
"webhook": hookUri,
"name": "Testing Microsoft Teams Winston",
"summary": "Test Logger",
"themeColor": "cf0808",
"sections": [{
"activityTitle": "You can add different sections within your card",
"activitySubtitle": "Section Subtitle",
"markdown": true
}],
"potentialAction": [{
"@type": "ActionCard",
"name": "Click Here To Comment",
"inputs": [{
"@type": "TextInput",
"id": "comment",
"isMultiline": false,
"title": "You can set action buttons, like this one that allows you to comment!"
}],
"actions": [{
"@type": "HttpPOST",
"name": "Add comment",
"target": "http://...URI TO POST INPUT TO"
}]
}, {
"@type": "ActionCard",
"name": "Click Here To Input a Date",
"inputs": [{
"@type": "DateInput",
"id": "dueDate",
"title": "This action allows you to select a date, customize the add a action with a target to post the input"
}],
"actions": [{
"@type": "HttpPOST",
"name": "Save",
"target": "http://...URI TO POST INPUT TO"
}]
}]
};
if (!hookUri) {
console.warn("No process.env.HOOK_URI set. Please set it to your Connector Webhook URI before running this test.");
process.exit();
}
const logger = createLogger({
transports: [
new (msTeamsWinston) (msTeamsWinstonOptions)
],
exitOnError: false
});
function runTest() {
logger.info('MSTeams will render markdown from messages. `Log a block of code` or some *italic text* \n > maybe add a quote block', { title: 'MSTeams supports the use of Markdown in messages.' });
try {
throw new Error('TEST');
} catch (e) {
logger.error(e.message);
}
}
runTest();