LogTag.java revision 0a1d838ccd16ac08300bb8ac89b61ee0c956a49b
12e2725239c3761147d88e0322427cc63b70c7b96kristianm/*
22e2725239c3761147d88e0322427cc63b70c7b96kristianm * Copyright (C) 2010 The Android Open Source Project
32e2725239c3761147d88e0322427cc63b70c7b96kristianm *
42e2725239c3761147d88e0322427cc63b70c7b96kristianm * Licensed under the Apache License, Version 2.0 (the "License");
52e2725239c3761147d88e0322427cc63b70c7b96kristianm * you may not use this file except in compliance with the License.
62e2725239c3761147d88e0322427cc63b70c7b96kristianm * You may obtain a copy of the License at
72e2725239c3761147d88e0322427cc63b70c7b96kristianm *
82e2725239c3761147d88e0322427cc63b70c7b96kristianm *      http://www.apache.org/licenses/LICENSE-2.0
92e2725239c3761147d88e0322427cc63b70c7b96kristianm *
102e2725239c3761147d88e0322427cc63b70c7b96kristianm * Unless required by applicable law or agreed to in writing, software
112e2725239c3761147d88e0322427cc63b70c7b96kristianm * distributed under the License is distributed on an "AS IS" BASIS,
122e2725239c3761147d88e0322427cc63b70c7b96kristianm * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132e2725239c3761147d88e0322427cc63b70c7b96kristianm * See the License for the specific language governing permissions and
142e2725239c3761147d88e0322427cc63b70c7b96kristianm * limitations under the License.
152e2725239c3761147d88e0322427cc63b70c7b96kristianm */
162e2725239c3761147d88e0322427cc63b70c7b96kristianm
172e2725239c3761147d88e0322427cc63b70c7b96kristianmpackage com.android.browser;
182e2725239c3761147d88e0322427cc63b70c7b96kristianm
192e2725239c3761147d88e0322427cc63b70c7b96kristianmimport android.util.Log;
202e2725239c3761147d88e0322427cc63b70c7b96kristianmimport android.util.EventLog;
212e2725239c3761147d88e0322427cc63b70c7b96kristianm
222e2725239c3761147d88e0322427cc63b70c7b96kristianmpublic class LogTag {
232e2725239c3761147d88e0322427cc63b70c7b96kristianm
242e2725239c3761147d88e0322427cc63b70c7b96kristianm    /**
252e2725239c3761147d88e0322427cc63b70c7b96kristianm     * Log when the user is adding a new bookmark.
262e2725239c3761147d88e0322427cc63b70c7b96kristianm     *
272e2725239c3761147d88e0322427cc63b70c7b96kristianm     * @param url the url of the new bookmark.
280a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen     * @param where the location from where the bookmark was added
292e2725239c3761147d88e0322427cc63b70c7b96kristianm     */
300a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen    public static void logBookmarkAdded(String url, String where) {
310a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen        EventLog.writeEvent(EventLogTags.BROWSER_BOOKMARK_ADDED, url + "|"
320a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen            + where);
332e2725239c3761147d88e0322427cc63b70c7b96kristianm    }
342e2725239c3761147d88e0322427cc63b70c7b96kristianm
352e2725239c3761147d88e0322427cc63b70c7b96kristianm    /**
362e2725239c3761147d88e0322427cc63b70c7b96kristianm     * Log when a page has finished loading with how much
372e2725239c3761147d88e0322427cc63b70c7b96kristianm     * time the browser used to load the page.
382e2725239c3761147d88e0322427cc63b70c7b96kristianm     *
390a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen     * @param url the url of that page that finished loading.
402e2725239c3761147d88e0322427cc63b70c7b96kristianm     * @param duration the time the browser spent loading the page.
412e2725239c3761147d88e0322427cc63b70c7b96kristianm     */
422e2725239c3761147d88e0322427cc63b70c7b96kristianm    public static void logPageFinishedLoading(String url, long duration) {
430a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen        EventLog.writeEvent(EventLogTags.BROWSER_BOOKMARK_ADDED, url + "|"
440a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen            + duration);
452e2725239c3761147d88e0322427cc63b70c7b96kristianm    }
462e2725239c3761147d88e0322427cc63b70c7b96kristianm
472e2725239c3761147d88e0322427cc63b70c7b96kristianm    /**
482e2725239c3761147d88e0322427cc63b70c7b96kristianm     * log the time the user has spent on a webpage
492e2725239c3761147d88e0322427cc63b70c7b96kristianm     *
502e2725239c3761147d88e0322427cc63b70c7b96kristianm     * @param url the url of the page that is being logged (old page).
512e2725239c3761147d88e0322427cc63b70c7b96kristianm     * @param duration the time spent on the webpage.
522e2725239c3761147d88e0322427cc63b70c7b96kristianm     */
532e2725239c3761147d88e0322427cc63b70c7b96kristianm    public static void logTimeOnPage(String url, long duration) {
540a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen        EventLog.writeEvent(EventLogTags.BROWSER_BOOKMARK_ADDED, url + "|"
550a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen            + duration);
562e2725239c3761147d88e0322427cc63b70c7b96kristianm    }
572e2725239c3761147d88e0322427cc63b70c7b96kristianm}
58