Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: runtime/bin/gen_snapshot.cc

Issue 11312242: Revised CL for customisable logging (replacing printfs). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/gen_snapshot.cc
===================================================================
--- runtime/bin/gen_snapshot.cc (revision 14903)
+++ runtime/bin/gen_snapshot.cc (working copy)
@@ -14,12 +14,13 @@
#include "bin/builtin.h"
#include "bin/dartutils.h"
#include "bin/file.h"
+#include "bin/log.h"
siva 2012/11/15 18:46:48 Please add a blank line after this (would like to
gram 2012/11/15 21:16:50 Done.
#include "platform/globals.h"
#define CHECK_RESULT(result) \
if (Dart_IsError(result)) { \
free(snapshot_buffer); \
- fprintf(stderr, "Error: %s", Dart_GetError(result)); \
+ Log::PrintErr("Error: %s", Dart_GetError(result)); \
Dart_ExitScope(); \
Dart_ShutdownIsolate(); \
exit(255); \
@@ -205,16 +206,14 @@
static void PrintUsage() {
- fprintf(stderr,
- "dart [<vm-flags>] "
- "[<dart-script-file>]\n");
+ Log::PrintErr("dart [<vm-flags>] [<dart-script-file>]\n");
}
static void VerifyLoaded(Dart_Handle library) {
if (Dart_IsError(library)) {
const char* err_msg = Dart_GetError(library);
- fprintf(stderr, "Errors encountered while loading: %s\n", err_msg);
+ Log::PrintErr("Errors encountered while loading: %s\n", err_msg);
Dart_ExitScope();
Dart_ShutdownIsolate();
exit(255);
@@ -251,7 +250,7 @@
// Set up the library tag handler for this isolate.
Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler);
if (Dart_IsError(result)) {
- fprintf(stderr, "%s", Dart_GetError(result));
+ Log::PrintErr("%s", Dart_GetError(result));
Dart_ExitScope();
Dart_ShutdownIsolate();
exit(255);
@@ -290,7 +289,7 @@
}
if (snapshot_filename == NULL) {
- fprintf(stderr, "No snapshot output file specified\n");
+ Log::PrintErr("No snapshot output file specified\n");
return 255;
}
@@ -302,14 +301,14 @@
// Note: We don't expect isolates to be created from dart code during
// snapshot generation.
if (!Dart_Initialize(NULL, NULL, NULL)) {
- fprintf(stderr, "VM initialization failed\n");
+ Log::PrintErr("VM initialization failed\n");
return 255;
}
char* error;
Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &error);
if (isolate == NULL) {
- fprintf(stderr, "Error: %s", error);
+ Log::PrintErr("Error: %s", error);
free(error);
exit(255);
}
@@ -360,7 +359,7 @@
NULL,
&error);
if (isolate == NULL) {
- fprintf(stderr, "%s", error);
+ Log::PrintErr("%s", error);
free(error);
free(snapshot_buffer);
exit(255);

Powered by Google App Engine
This is Rietveld 408576698