Move logging interface out of QPL plugin
Summary: This is generic enough, even though I strongly dislike the installing mechanism, but that can be changed later. Reviewed By: oprisnik Differential Revision: D14131183 fbshipit-source-id: b75c1e1563ac9371cbc7d28b239c316a0aa1a9dd
This commit is contained in:
committed by
Facebook Github Bot
parent
81e8b7982b
commit
7f77dd1c1a
@@ -0,0 +1,32 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
|
||||||
|
package com.facebook.flipper.plugins.qpl.api;
|
||||||
|
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
|
public class FlipperPerfLogger {
|
||||||
|
|
||||||
|
@Nullable private static PerfLoggerDelegate mDelegate;
|
||||||
|
|
||||||
|
public static void startMarker(String name) {
|
||||||
|
if (mDelegate != null) {
|
||||||
|
mDelegate.starMarker(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void endMarker(String name) {
|
||||||
|
if (mDelegate != null) {
|
||||||
|
mDelegate.endMarker(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cancelMarker(String name) {
|
||||||
|
if (mDelegate != null) {
|
||||||
|
mDelegate.cancelMarker(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setDelegate(PerfLoggerDelegate delegate) {
|
||||||
|
mDelegate = delegate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
|
||||||
|
package com.facebook.flipper.plugins.qpl.api;
|
||||||
|
|
||||||
|
public interface PerfLoggerDelegate {
|
||||||
|
void starMarker(String name);
|
||||||
|
|
||||||
|
void endMarker(String name);
|
||||||
|
|
||||||
|
void cancelMarker(String name);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
|
|
||||||
|
package com.facebook.flipper.plugins.qpl.api;
|
||||||
|
|
||||||
|
public class PerfLoggerDelegateInstaller {
|
||||||
|
public static void install(PerfLoggerDelegate delegate) {
|
||||||
|
FlipperPerfLogger.setDelegate(delegate);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user