|
6 | 6 | public class Logger { |
7 | 7 | private final GithubExtension extension; |
8 | 8 | private final Project project; |
9 | | - /** |
10 | | - * Constructs a new instance of Logger using the provided {@link Project} instance. |
11 | | - * |
12 | | - * @param project The {@link Project} instance associated with this Logger. |
13 | | - * |
14 | | - * @throws NullPointerException If the {@code project} is null. |
15 | | - * |
16 | | - * @see GithubExtension |
17 | | - */ |
| 9 | + |
18 | 10 | public Logger(Project project) { |
19 | 11 | this(project.getExtensions().getByType(GithubExtension.class), project); |
20 | 12 | } |
21 | | - /** |
22 | | - * Constructs a new instance of Logger. |
23 | | - * |
24 | | - * @param extension The {@link GithubExtension} instance to be used for logging configuration. |
25 | | - * @param project The {@link Project} instance associated with this Logger. |
26 | | - * |
27 | | - * @throws NullPointerException If either {@code extension} or {@code project} is null. |
28 | | - */ |
| 13 | + |
29 | 14 | public Logger(GithubExtension extension, Project project) { |
30 | 15 | if (extension == null || project == null) { |
31 | 16 | throw new NullPointerException("extension and project cannot be null"); |
32 | 17 | } |
33 | 18 | this.extension = extension; |
34 | 19 | this.project = project; |
35 | 20 | } |
36 | | - /** |
37 | | - * Logs a message at the lifecycle level. |
38 | | - * |
39 | | - * @param message The message to be logged. |
40 | | - */ |
| 21 | + |
41 | 22 | public void log(String message) { |
42 | 23 | project.getLogger().lifecycle(message); |
43 | 24 | } |
44 | 25 |
|
45 | | - /** |
46 | | - * Logs an error message. |
47 | | - * |
48 | | - * @param message The error message to be logged. |
49 | | - */ |
50 | 26 | public void error(String message) { |
51 | 27 | project.getLogger().error(message); |
52 | 28 | } |
53 | 29 |
|
54 | | - /** |
55 | | - * Logs a debug message if the debug mode is enabled or the log level is INFO or DEBUG. |
56 | | - * |
57 | | - * @param message The debug message to be logged. |
58 | | - */ |
59 | 30 | public void debug(String message) { |
60 | 31 | LogLevel logLevel = project.getGradle().getStartParameter().getLogLevel(); |
61 | 32 | if (extension.isDebug() || logLevel.equals(LogLevel.INFO) || logLevel.equals(LogLevel.DEBUG)) { |
62 | 33 | project.getLogger().lifecycle(message); |
63 | 34 | } |
64 | 35 | } |
65 | 36 |
|
66 | | - /** |
67 | | - * Logs a warning message. |
68 | | - * |
69 | | - * @param message The warning message to be logged. |
70 | | - */ |
71 | 37 | public void warn(String message) { |
72 | 38 | project.getLogger().warn(message); |
73 | 39 | } |
|
0 commit comments