better logging (#9090)

This commit is contained in:
William Cheng 2021-03-26 18:21:59 +08:00 committed by GitHub
parent e71ae12e14
commit 854296634a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -385,14 +385,14 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
// model name cannot use reserved keyword, e.g. return
if (isReservedWord(camelizedName)) {
final String modelName = "Model" + camelizedName;
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName);
return modelName;
}
// model name starts with number
if (camelizedName.matches("^\\d.*")) {
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name, modelName);
return modelName;
}
@ -471,7 +471,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p);
if (openAPIType == null) {
LOGGER.error("No Type defined for Schema " + p);
LOGGER.error("No Type defined for Schema {}", p);
}
if (typeMapping.containsKey(openAPIType)) {
return typeMapping.get(openAPIType);
@ -601,13 +601,13 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
// method name cannot use reserved keyword, e.g. return
if (isReservedWord(operationId)) {
String newOperationId = camelize("call_" + operationId, true);
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId);
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
return newOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true);
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + operationId), true);
operationId = camelize("call_" + operationId, true);
}