-
Notifications
You must be signed in to change notification settings - Fork 266
Extending chkbugreport
If you have get the source code, you can create your own plugin as well:
-
Create a project in eclipse and add the ChkBugReport project to the java build path
-
Create a subclass of Plugin which implements ExternalPlugin (for example call it FoobarPlugin)
-
Implement initExternalPlugin like this (this will activate your plugin only when processing bugreports and not when processing traceview dumps):
@Override public void initExternalPlugin(Module mod) { if (mod instanceof BugReportModule) { mod.addPlugin(this); } }
-
implement
getPrio
to return a number between 0 and 100. This will determine when will your plugin execute compared to other plugins. If you are dependent on data from other plugins, you should have a higher number. -
implement
reset
,load
andgenerate
(see below for more details) -
Creating a jar file and add a "ChkBugReport-Plugin" manifest key with your plugin class name as value
-
place the jar file into ~/.chkbugreport folder.
Executing the plugins are done in 3 steps:
- first, each plugins reset method is called to reset their internal state
- then load is called on each plugin to load the raw data into memory, and if possible even do some processing
- finally generate is called on each plugin to finish processing and generate the report
More details will follow later on, for now use the source as documentation.
If you just want to plot some values based on some logs, it's much easier to create an xml "plugin". For example save the following xml file as ~/.chkbugreport/example.xml:
<plugin name="ExamplePlugin">
<generate>
<chapter name="Example/Test 1">
<text>This is just some example test</text>
<logchart name="Battery level" file="ex_battery_level">
<dataset id="level" name="Battery level" type="plot" min="0" max="100" />
<dataset id="screen" name="Screen on" type="state" colors="#0f0,#ff0,#f00" />
<dataset id="am" name="ActivityManager" type="event" colors="#080,#f00" />
<filter log="event" matchTag="battery_level" matchMsg=".(.*),.*,.*\]" dataset="level" />
<filter log="event" matchTag="screen_toggled" matchMsg="(.)" dataset="screen" />
<filter log="event" matchTag="am_proc_start" dataset="am" value="0" />
<filter log="event" matchTag="am_proc_died" dataset="am" value="1" />
</logchart>
</chapter>
</generate>
</plugin>
For more information, see XML Plugins.