dom/plugins/base/android/ANPLog.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/base/android/ANPLog.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "assert.h"
    1.10 +#include "ANPBase.h"
    1.11 +#include <android/log.h>
    1.12 +
    1.13 +#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
    1.14 +#define ASSIGN(obj, name)   (obj)->name = anp_log_##name
    1.15 +
    1.16 +void
    1.17 +anp_log_log(ANPLogType type, const char format[], ...) {
    1.18 +
    1.19 +  va_list argp;
    1.20 +  va_start(argp,format);
    1.21 +  __android_log_vprint(type == kError_ANPLogType ? ANDROID_LOG_ERROR : type == kWarning_ANPLogType ?
    1.22 +                       ANDROID_LOG_WARN : ANDROID_LOG_INFO, "GeckoPluginLog", format, argp);
    1.23 +  va_end(argp);
    1.24 +}
    1.25 +
    1.26 +void InitLogInterface(ANPLogInterfaceV0 *i) {
    1.27 +      _assert(i->inSize == sizeof(*i));
    1.28 +      ASSIGN(i, log);
    1.29 +}

mercurial