| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -111,7 +111,6 @@ std::string TriggerNodeReport(Isolate* isolate, | |||
| 111 | 111 | // Obtain the current time and the pid (platform dependent) | |
| 112 | 112 | TIME_TYPE tm_struct; | |
| 113 | 113 | LocalTime(&tm_struct); | |
| 114 | - uv_pid_t pid = uv_os_getpid(); | ||
| 115 | 114 | // Determine the required report filename. In order of priority: | |
| 116 | 115 | // 1) supplied on API 2) configured on startup 3) default generated | |
| 117 | 116 | if (!name.empty()) { | |
@@ -123,34 +122,31 @@ std::string TriggerNodeReport(Isolate* isolate, | |||
| 123 | 122 | } else { | |
| 124 | 123 | // Construct the report filename, with timestamp, pid and sequence number | |
| 125 | 124 | oss << "report"; | |
| 126 | - seq++; | ||
| 127 | 125 | #ifdef _WIN32 | |
| 128 | 126 | oss << "." << std::setfill('0') << std::setw(4) << tm_struct.wYear; | |
| 129 | 127 | oss << std::setfill('0') << std::setw(2) << tm_struct.wMonth; | |
| 130 | 128 | oss << std::setfill('0') << std::setw(2) << tm_struct.wDay; | |
| 131 | 129 | oss << "." << std::setfill('0') << std::setw(2) << tm_struct.wHour; | |
| 132 | 130 | oss << std::setfill('0') << std::setw(2) << tm_struct.wMinute; | |
| 133 | 131 | oss << std::setfill('0') << std::setw(2) << tm_struct.wSecond; | |
| 134 | - oss << "." << pid; | ||
| 135 | - oss << "." << std::setfill('0') << std::setw(3) << seq.load(); | ||
| 136 | 132 | #else // UNIX, OSX | |
| 137 | 133 | oss << "." << std::setfill('0') << std::setw(4) << tm_struct.tm_year + 1900; | |
| 138 | 134 | oss << std::setfill('0') << std::setw(2) << tm_struct.tm_mon + 1; | |
| 139 | 135 | oss << std::setfill('0') << std::setw(2) << tm_struct.tm_mday; | |
| 140 | 136 | oss << "." << std::setfill('0') << std::setw(2) << tm_struct.tm_hour; | |
| 141 | 137 | oss << std::setfill('0') << std::setw(2) << tm_struct.tm_min; | |
| 142 | 138 | oss << std::setfill('0') << std::setw(2) << tm_struct.tm_sec; | |
| 143 | - oss << "." << pid; | ||
| 144 | - oss << "." << std::setfill('0') << std::setw(3) << seq.load(); | ||
| 145 | 139 | #endif | |
| 140 | + oss << "." << uv_os_getpid(); | ||
| 141 | + oss << "." << std::setfill('0') << std::setw(3) << ++seq; | ||
| 146 | 142 | oss << ".json"; | |
| 147 | 143 | } | |
| 148 | 144 | ||
| 149 | 145 | filename = oss.str(); | |
| 150 | 146 | // Open the report file stream for writing. Supports stdout/err, | |
| 151 | 147 | // user-specified or (default) generated name | |
| 152 | 148 | std::ofstream outfile; | |
| 153 | - std::ostream* outstream = &std::cout; | ||
| 149 | + std::ostream* outstream; | ||
| 154 | 150 | if (filename == "stdout") { | |
| 155 | 151 | outstream = &std::cout; | |
| 156 | 152 | } else if (filename == "stderr") { | |
@@ -167,21 +163,18 @@ std::string TriggerNodeReport(Isolate* isolate, | |||
| 167 | 163 | } | |
| 168 | 164 | // Check for errors on the file open | |
| 169 | 165 | if (!outfile.is_open()) { | |
| 170 | - if (env != nullptr && options->report_directory.length() > 0) { | ||
| 171 | - std::cerr << std::endl | ||
| 172 | - << "Failed to open Node.js report file: " << filename | ||
| 173 | - << " directory: " << options->report_directory | ||
| 174 | - << " (errno: " << errno << ")" << std::endl; | ||
| 175 | - } else { | ||
| 176 | - std::cerr << std::endl | ||
| 177 | - << "Failed to open Node.js report file: " << filename | ||
| 178 | - << " (errno: " << errno << ")" << std::endl; | ||
| 179 | - } | ||
| 180 | - return ""; | ||
| 181 | - } else { | ||
| 182 | 166 | std::cerr << std::endl | |
| 183 | - << "Writing Node.js report to file: " << filename << std::endl; | ||
| 167 | + << "Failed to open Node.js report file: " << filename; | ||
| 168 | + | ||
| 169 | + if (env != nullptr && options->report_directory.length() > 0) | ||
| 170 | + std::cerr << " directory: " << options->report_directory; | ||
| 171 | + | ||
| 172 | + std::cerr << " (errno: " << errno << ")" << std::endl; | ||
| 173 | + return ""; | ||
| 184 | 174 | } | |
| 175 | + | ||
| 176 | + std::cerr << std::endl | ||
| 177 | + << "Writing Node.js report to file: " << filename << std::endl; | ||
| 185 | 178 | } | |
| 186 | 179 | ||
| 187 | 180 | // Pass our stream about by reference, not by copying it. | |
@@ -196,8 +189,7 @@ std::string TriggerNodeReport(Isolate* isolate, | |||
| 196 | 189 | } | |
| 197 | 190 | ||
| 198 | 191 | std::cerr << "Node.js report completed" << std::endl; | |
| 199 | - if (name.empty()) return filename; | ||
| 200 | - return name; | ||
| 192 | + return filename; | ||
| 201 | 193 | } | |
| 202 | 194 | ||
| 203 | 195 | // External function to trigger a report, writing to a supplied stream. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments