Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

hugo

> 编程语言
Open source

Annotation-triggered method call logging for your debug builds.

7.9K stars0 likes3 views
WebsiteGitHub

About

Annotation-triggered method call logging for your debug builds.

Hugo

Annotation-triggered method call logging for your debug builds.

As a programmer, you often add log statements to print method calls, their arguments, their return values, and the time it took to execute. This is not a question. Every one of you does this. Shouldn't it be easier?

Simply add @DebugLog to your methods and you will automatically get all of the things listed above logged for free.

java
@DebugLog
public String getName(String first, String last) {
  SystemClock.sleep(15); // Don't ever really do this!
  return first + " " + last;
}
V/Example: ⇢ getName(first="Jake", last="Wharton")
V/Example: ⇠ getName [16ms] = "Jake Wharton"

The logging will only happen in debug builds and the annotation itself is never present in the compiled class file for any build type. This means you can keep the annotation and check it into source control. It has zero effect on non-debug builds.

Add it to your project today!

groovy
buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
  }
}

apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'

Disable logging temporarily by adding the following:

groovy
hugo {
  enabled false
}

If you want to toggle logging at runtime, use Hugo.setEnabled(true|false)

Local Development

Working on this project? Here's some helpful Gradle tasks:

  • install - Install plugin, runtime, and annotations into local repo.
  • cleanExample - Clean the example project build.
  • assembleExample - Build the example project. Must run install first.
  • installExample - Build and install the example project debug APK onto a device.

License

Copyright 2013 Jake Wharton

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Issues· 60 open

View all issuesOpen on GitHub
  • #178

    no log

    Updated Jul 26, 2022
  • #177

    please solve this type of issue

    Updated Apr 27, 2022
  • #85

    -

    Updated Jan 28, 2022
  • #172

    project build generate ajcore.20200706.144640.553.txt

    Updated Apr 27, 2021
  • #164

    appear bug.

    Updated Mar 17, 2021
  • #123

    No output from Hugo

    Updated Oct 28, 2020
  • #175

    runtime Cause: zip file is empty

    Updated Sep 7, 2020
  • #174

    Cannot be used in android unit test

    Updated Aug 24, 2020
  • #173

    Not working with multi-module Kotlin Android project

    Updated Aug 10, 2020
  • #168

    Unable to integrate into project

    Updated Jan 14, 2020

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言