Chromium Code Reviews| 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); |