forked from joelittlejohn/jsonschema2pojo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
joelittlejohn#113 Create RuleLogger interface and implementations.
- Loading branch information
Showing
4 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
jsonschema2pojo-cli/src/main/java/org/jsonschema2pojo/cli/CommandLineLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright © 2010-2017 Nokia | ||
* <p> | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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. | ||
*/ | ||
|
||
package org.jsonschema2pojo.cli; | ||
|
||
import org.jsonschema2pojo.RuleLogger; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class CommandLineLogger implements RuleLogger { | ||
|
||
private final Logger log = LoggerFactory.getLogger(Jsonschema2PojoCLI.class); | ||
|
||
@Override | ||
public void debug(String msg) { | ||
log.debug(msg); | ||
} | ||
|
||
@Override | ||
public void error(String msg) { | ||
log.error(msg); | ||
} | ||
|
||
@Override | ||
public void info(String msg) { | ||
log.info(msg); | ||
} | ||
|
||
@Override | ||
public void trace(String msg) { | ||
log.trace(msg); | ||
} | ||
|
||
@Override | ||
public void warn(String msg) { | ||
log.warn(msg); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/RuleLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright © 2010-2017 Nokia | ||
* <p> | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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. | ||
*/ | ||
|
||
package org.jsonschema2pojo; | ||
|
||
public interface RuleLogger { | ||
|
||
void debug(String msg); | ||
|
||
void error(String msg); | ||
|
||
void info(String msg); | ||
|
||
void trace(String msg); | ||
|
||
void warn(String msg); | ||
} |
51 changes: 51 additions & 0 deletions
51
...ema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/GradleRuleLogger.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright © 2010-2017 Nokia | ||
* | ||
* 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. | ||
*/ | ||
package org.jsonschema2pojo.gradle | ||
|
||
import org.gradle.api.logging.Logger | ||
import org.jsonschema2pojo.RuleLogger | ||
|
||
class GradleRuleLogger implements RuleLogger { | ||
|
||
Logger logger | ||
|
||
GradleRuleLogger(Logger logger) { | ||
super() | ||
this.logger = logger | ||
} | ||
|
||
@Override | ||
void debug(String msg) { | ||
logger.debug(msg) | ||
} | ||
|
||
@Override | ||
void error(String msg) { | ||
logger.error(msg) | ||
} | ||
|
||
@Override | ||
void info(String msg) { | ||
logger.info(msg) | ||
} | ||
|
||
@Override | ||
void trace(String msg) { | ||
logger.trace(msg) | ||
} | ||
|
||
@Override | ||
void warn(String msg) { | ||
logger.warn(msg) | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
jsonschema2pojo-maven-plugin/src/main/java/org/jsonschema2pojo/maven/MojoRuleLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright © 2010-2017 Nokia | ||
* | ||
* 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. | ||
*/ | ||
|
||
package org.jsonschema2pojo.maven; | ||
|
||
import org.apache.maven.plugin.logging.Log; | ||
import org.jsonschema2pojo.RuleLogger; | ||
|
||
public class MojoRuleLogger implements RuleLogger { | ||
private final Log log; | ||
|
||
public MojoRuleLogger(Log log) { | ||
super(); | ||
this.log = log; | ||
} | ||
|
||
@Override | ||
public void debug(String msg) { | ||
log.debug(msg); | ||
} | ||
|
||
@Override | ||
public void error(String msg) { | ||
log.error(msg); | ||
} | ||
|
||
@Override | ||
public void info(String msg) { | ||
log.info(msg); | ||
} | ||
|
||
@Override | ||
public void trace(String msg) { | ||
log.debug(msg); // No trace level for Mojo Logger | ||
} | ||
|
||
@Override | ||
public void warn(String msg) { | ||
log.warn(msg); | ||
} | ||
} |