Adding Logcat to Extent Report

I wanted to add logcat logs to extent report in case a test fails.
I followed a blog by Jonathan Lipps on HeadSpin:
https://www.headspin.io/blog/accessing-android-logcat-logs-with-appium
I am unable to get how I can use this in listener class on method onTestFailure.

are you using Junit or TestNG with your tests (Java)? or what lang you using? We cant help without details…

@Aleksei I am using JAVA+TestNG

ok. so you should grab your logcat in

@AfterMethod(alwaysRun = true)
public void afterMethod() {
  LogEntries logs = driver.manage().logs().get("logcat");
 // here get screenshot or video
 // here quit driver
}