Skip to content

Commit 5b6fc73

Browse files
committed
add logs for all external file loading Haehnchen#68
1 parent 21e7039 commit 5b6fc73

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/fr/adrienbrault/idea/symfony2plugin/Symfony2ProjectComponent.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.HashMap;
2222
import java.util.List;
2323
import java.util.Map;
24+
import com.intellij.openapi.diagnostic.Logger;
2425

2526
/**
2627
* @author Adrien Brault <adrien.brault@gmail.com>
@@ -29,6 +30,8 @@ public class Symfony2ProjectComponent implements ProjectComponent {
2930

3031
public static String HELP_URL = "http://symfony2-plugin.espend.de/";
3132

33+
final private static Logger LOG = Logger.getInstance("Symfony2-Plugin");
34+
3235
private Project project;
3336

3437
private Map<String, Route> routes;
@@ -60,6 +63,10 @@ public void projectClosed() {
6063
// System.out.println("projectClosed");
6164
}
6265

66+
public static Logger getLogger() {
67+
return LOG;
68+
}
69+
6370
public void showInfoNotification(String content) {
6471
Notification errorNotification = new Notification("Symfony2 Plugin", "Symfony2 Plugin", content, NotificationType.INFORMATION);
6572
Notifications.Bus.notify(errorNotification, this.project);
@@ -77,6 +84,7 @@ public Map<String, Route> getRoutes() {
7784
VirtualFile virtualUrlGeneratorFile = VfsUtil.findFileByIoFile(urlGeneratorFile, false);
7885

7986
if (virtualUrlGeneratorFile == null || !urlGeneratorFile.exists()) {
87+
Symfony2ProjectComponent.getLogger().warn("missing routing: " + urlGeneratorFile.toString());
8088
return routes;
8189
}
8290

@@ -85,6 +93,8 @@ public Map<String, Route> getRoutes() {
8593
return this.routes;
8694
}
8795

96+
Symfony2ProjectComponent.getLogger().info("update routing: " + urlGeneratorFile.toString());
97+
8898
try {
8999
routes = RouteHelper.getRoutes(VfsUtil.loadText(virtualUrlGeneratorFile));
90100
} catch (IOException e) {
@@ -115,13 +125,16 @@ public ArrayList<File> getContainerFiles(boolean attachSetting) {
115125
}
116126

117127
if(containerFiles.size() == 0) {
128+
Symfony2ProjectComponent.getLogger().info("no custom container files add default");
118129
containerFiles.add(new ContainerFile(Settings.DEFAULT_CONTAINER_PATH));
119130
}
120131

121132
ArrayList<File> validFiles = new ArrayList<File>();
122133
for(ContainerFile containerFile : containerFiles) {
123134
if(containerFile.exists(this.project)) {
124135
validFiles.add(containerFile.getFile(this.project));
136+
} else {
137+
Symfony2ProjectComponent.getLogger().warn("container file not exists skipping: " + containerFile.getPath());
125138
}
126139
}
127140

@@ -152,12 +165,14 @@ private void checkProject() {
152165

153166
if(this.getContainerFiles().size() == 0) {
154167
showInfoNotification("missing at least one container file");
168+
Symfony2ProjectComponent.getLogger().warn("missing at least one container file");
155169
}
156170

157171
String urlGeneratorPath = getPath(project, Settings.getInstance(project).pathToUrlGenerator);
158172
File urlGeneratorFile = new File(urlGeneratorPath);
159173
if (!urlGeneratorFile.exists()) {
160174
showInfoNotification("missing routing file: " + urlGeneratorPath);
175+
Symfony2ProjectComponent.getLogger().warn("missing routing file: " + urlGeneratorPath);
161176
}
162177

163178
}

src/fr/adrienbrault/idea/symfony2plugin/translation/TranslationIndex.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.intellij.openapi.project.Project;
44
import com.intellij.openapi.util.io.FileUtil;
55
import fr.adrienbrault.idea.symfony2plugin.Settings;
6+
import fr.adrienbrault.idea.symfony2plugin.Symfony2ProjectComponent;
67
import fr.adrienbrault.idea.symfony2plugin.translation.parser.TranslationStringMap;
78
import fr.adrienbrault.idea.symfony2plugin.translation.parser.TranslationStringParser;
89
import org.jetbrains.annotations.Nullable;
@@ -51,6 +52,8 @@ public TranslationStringMap getTranslationMap() {
5152
return new TranslationStringMap();
5253
}
5354

55+
Symfony2ProjectComponent.getLogger().info("update translations: " + translationDirectory.toString());
56+
5457
this.translationStringMapModified = translationDirectory.lastModified();
5558
return this.translationStringMap = new TranslationStringParser().parsePathMatcher(translationDirectory.getPath());
5659
}
@@ -76,6 +79,7 @@ protected File getTranslationRoot() {
7679

7780
File file = new File(translationPath);
7881
if(!file.exists() || !file.isDirectory()) {
82+
Symfony2ProjectComponent.getLogger().warn("missing translation path: " + file.toString());
7983
return null;
8084
}
8185

src/fr/adrienbrault/idea/symfony2plugin/util/service/ServiceXmlParserFactory.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ protected boolean isModified(ArrayList<File> serviceFiles) {
3636
if(!this.serviceFiles.get(serviceFile.getAbsolutePath()).equals(serviceFile.lastModified())) {
3737
return true;
3838
}
39+
} else {
40+
Symfony2ProjectComponent.getLogger().warn("file not found: " + serviceFiles.toString());
3941
}
4042
}
4143

@@ -55,6 +57,7 @@ public <T extends ServiceParserInterface> T parser(Class<T> serviceParser) {
5557

5658
try {
5759
this.serviceParserInstance = serviceParser.newInstance();
60+
Symfony2ProjectComponent.getLogger().info("new instance: " + serviceParser.getName());
5861
} catch (InstantiationException ignored) {
5962
} catch (IllegalAccessException ignored) {
6063
}
@@ -69,6 +72,8 @@ public <T extends ServiceParserInterface> T parser(Class<T> serviceParser) {
6972
}
7073
}
7174

75+
Symfony2ProjectComponent.getLogger().info("update: " + serviceParser.getName());
76+
7277
return (T) this.serviceParserInstance;
7378
}
7479

0 commit comments

Comments
 (0)