1 |
3a515b92
|
cagy
|
/*
|
2 |
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3 |
|
|
Author Tobias Koppers @sokra
|
4 |
|
|
*/
|
5 |
|
|
"use strict";
|
6 |
|
|
|
7 |
|
|
module.exports = function createInnerContext(options, message, messageOptional) {
|
8 |
|
|
let messageReported = false;
|
9 |
|
|
const childContext = {
|
10 |
|
|
log: (() => {
|
11 |
|
|
if(!options.log) return undefined;
|
12 |
|
|
if(!message) return options.log;
|
13 |
|
|
const logFunction = (msg) => {
|
14 |
|
|
if(!messageReported) {
|
15 |
|
|
options.log(message);
|
16 |
|
|
messageReported = true;
|
17 |
|
|
}
|
18 |
|
|
options.log(" " + msg);
|
19 |
|
|
};
|
20 |
|
|
return logFunction;
|
21 |
|
|
})(),
|
22 |
|
|
stack: options.stack,
|
23 |
|
|
missing: options.missing
|
24 |
|
|
};
|
25 |
|
|
return childContext;
|
26 |
|
|
};
|