Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
syslog_android.cc
Go to the documentation of this file.
1// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "platform/globals.h"
6#if defined(DART_HOST_OS_ANDROID)
7
8#include "platform/syslog.h"
9
10#include <android/log.h> // NOLINT
11#include <stdio.h> // NOLINT
12
13namespace dart {
14
15// TODO(gram): We should be buffering the data and only outputting
16// it when we see a '\n'.
17
18void Syslog::VPrint(const char* format, va_list args) {
19 // If we launch the DartVM inside "adb shell" we will only get messages
20 // (critical ones or not) if we print them to stdout/stderr.
21 // We also log using android's logging system.
22 va_list stdio_args;
23 va_copy(stdio_args, args);
24 vprintf(format, stdio_args);
25 fflush(stdout);
26 va_end(stdio_args);
27
28 va_list log_args;
29 va_copy(log_args, args);
30 __android_log_vprint(ANDROID_LOG_INFO, "Dart", format, log_args);
31 va_end(log_args);
32}
33
34void Syslog::VPrintErr(const char* format, va_list args) {
35 // If we launch the DartVM inside "adb shell" we will only get messages
36 // (critical ones or not) if we print them to stdout/stderr.
37 // We also log using android's logging system.
38 va_list stdio_args;
39 va_copy(stdio_args, args);
40 vfprintf(stderr, format, stdio_args);
41 fflush(stderr);
42 va_end(stdio_args);
43
44 va_list log_args;
45 va_copy(log_args, args);
46 __android_log_vprint(ANDROID_LOG_ERROR, "Dart", format, log_args);
47 va_end(log_args);
48}
49
50} // namespace dart
51
52#endif // defined(DART_HOST_OS_ANDROID)
VPrintErr(format, args)
VPrint(format, args)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format