Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
998 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 | /**
|
---|
| 3 | * @license
|
---|
| 4 | * Copyright Google LLC All Rights Reserved.
|
---|
| 5 | *
|
---|
| 6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 7 | * found in the LICENSE file at https://angular.io/license
|
---|
| 8 | */
|
---|
| 9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 10 | exports.writeErrorToLogFile = void 0;
|
---|
| 11 | const fs_1 = require("fs");
|
---|
| 12 | const os_1 = require("os");
|
---|
| 13 | const path_1 = require("path");
|
---|
| 14 | let logPath;
|
---|
| 15 | /**
|
---|
| 16 | * Writes an Error to a temporary log file.
|
---|
| 17 | * If this method is called multiple times from the same process the same log file will be used.
|
---|
| 18 | * @returns The path of the generated log file.
|
---|
| 19 | */
|
---|
| 20 | function writeErrorToLogFile(error) {
|
---|
| 21 | if (!logPath) {
|
---|
| 22 | const tempDirectory = fs_1.mkdtempSync(fs_1.realpathSync(os_1.tmpdir()) + '/ng-');
|
---|
| 23 | logPath = path_1.normalize(tempDirectory + '/angular-errors.log');
|
---|
| 24 | }
|
---|
| 25 | fs_1.appendFileSync(logPath, '[error] ' + (error.stack || error) + '\n\n');
|
---|
| 26 | return logPath;
|
---|
| 27 | }
|
---|
| 28 | exports.writeErrorToLogFile = writeErrorToLogFile;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.