Java Code Examples for com.intellij.openapi.diagnostic.Logger#debug()
The following examples show how to use
com.intellij.openapi.diagnostic.Logger#debug() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Util.java From sourcegraph-jetbrains with Apache License 2.0 | 6 votes |
public static String exec(String cmd, String dir) throws IOException { Logger.getInstance(Util.class).debug("exec cmd='" + cmd + "' dir="+dir); // Create the process. Process p = Runtime.getRuntime().exec(cmd, null, new File(dir)); BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream())); // Log any stderr ouput. Logger logger = Logger.getInstance(Util.class); String s; while ((s = stderr.readLine()) != null) { logger.debug(s); } String out = new String(); for (String l; (l = stdout.readLine()) != null; out += l + "\n"); return out; }
Example 2
Source File: Open.java From sourcegraph-jetbrains with Apache License 2.0 | 5 votes |
@Override void handleFileUri(String uri) { Logger logger = Logger.getInstance(this.getClass()); // Open the URL in the browser. try { Desktop.getDesktop().browse(URI.create(uri)); } catch (IOException err) { logger.debug("failed to open browser"); err.printStackTrace(); } return; }
Example 3
Source File: FileAction.java From sourcegraph-jetbrains with Apache License 2.0 | 4 votes |
@Override public void actionPerformed(AnActionEvent e) { Logger logger = Logger.getInstance(this.getClass()); // Get project, editor, document, file, and position information. final Project project = e.getProject(); if (project == null) { return; } Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor == null) { return; } Document currentDoc = editor.getDocument(); if (currentDoc == null) { return; } VirtualFile currentFile = FileDocumentManager.getInstance().getFile(currentDoc); if (currentFile == null) { return; } SelectionModel sel = editor.getSelectionModel(); // Get repo information. RepoInfo repoInfo = Util.repoInfo(currentFile.getPath()); if (repoInfo.remoteURL == "") { return; } // Build the URL that we will open. String productName = ApplicationInfo.getInstance().getVersionName(); String productVersion = ApplicationInfo.getInstance().getFullVersion(); String uri; try { LogicalPosition start = editor.visualToLogicalPosition(sel.getSelectionStartPosition()); LogicalPosition end = editor.visualToLogicalPosition(sel.getSelectionEndPosition()); uri = Util.sourcegraphURL(project)+"-/editor" + "?remote_url=" + URLEncoder.encode(repoInfo.remoteURL, "UTF-8") + "&branch=" + URLEncoder.encode(repoInfo.branch, "UTF-8") + "&file=" + URLEncoder.encode(repoInfo.fileRel, "UTF-8") + "&editor=" + URLEncoder.encode("JetBrains", "UTF-8") + "&version=" + URLEncoder.encode(Util.VERSION, "UTF-8") + "&utm_product_name=" + URLEncoder.encode(productName, "UTF-8") + "&utm_product_version=" + URLEncoder.encode(productVersion, "UTF-8") + "&start_row=" + URLEncoder.encode(Integer.toString(start.line), "UTF-8") + "&start_col=" + URLEncoder.encode(Integer.toString(start.column), "UTF-8") + "&end_row=" + URLEncoder.encode(Integer.toString(end.line), "UTF-8") + "&end_col=" + URLEncoder.encode(Integer.toString(end.column), "UTF-8"); } catch (UnsupportedEncodingException err) { logger.debug("failed to build URL"); err.printStackTrace(); return; } handleFileUri(uri); }
Example 4
Source File: PythonInfoModifier.java From intellij-pants-plugin with Apache License 2.0 | 4 votes |
/** * Unfortunately Python plugin doesn't support package prefixes for source root. * To workaround it at the moment we will create two targets: one for tests and one for production sources. * * todo: remove once https://youtrack.jetbrains.com/issue/PY-16830 is resolved */ @Override public void modify( @NotNull ProjectInfo projectInfo, @NotNull PantsCompileOptionsExecutor executor, @NotNull Logger log ) { TargetInfo sources = new TargetInfo(); TargetInfo tests = new TargetInfo(); final Set<String> pythonTargetNames = ContainerUtilRt.newHashSet(); for (Map.Entry<String, TargetInfo> entry : projectInfo.getTargets().entrySet()) { final String targetName = entry.getKey(); final TargetInfo targetInfo = entry.getValue(); if (!targetInfo.isPythonTarget()) { continue; } pythonTargetNames.add(targetName); if (targetInfo.isTest()) { tests = tests.union(targetInfo); } else { sources = sources.union(targetInfo); } } if (sources.isEmpty()) { return; } projectInfo.removeTargets(pythonTargetNames); if (!pythonTargetNames.isEmpty() && log.isDebugEnabled()) { log.debug(String.format("Combining %d python targets", pythonTargetNames.size())); } sources.getTargets().removeAll(pythonTargetNames); projectInfo.addTarget("python:src", sources); if (!tests.isEmpty()) { // make sure src and test don't have common roots sources.getRoots().removeAll(tests.getRoots()); tests.getTargets().removeAll(pythonTargetNames); tests.getTargets().add("python:src"); projectInfo.addTarget("python:tests", tests); } }
Example 5
Source File: HaxeDebugTimeLog.java From intellij-haxe with Apache License 2.0 | 4 votes |
public void log(@NotNull Logger logger) { logger.debug(buildLogMsg(false, null, null)); }
Example 6
Source File: HaxeDebugTimeLog.java From intellij-haxe with Apache License 2.0 | 4 votes |
public void log(@NotNull Logger logger, boolean showTimeStamp, @Nullable TimeStamp first, @Nullable TimeStamp previous) { logger.debug(buildLogMsg(showTimeStamp, first, previous)); }
Example 7
Source File: HaxeDebugTimeLog.java From intellij-haxe with Apache License 2.0 | 2 votes |
/** * Log an event and time to the given Logger. * * @param logger where to write the time stamp. * @param message text to identify the message. */ public static void logStamp(@NotNull Logger logger, @Nullable String message) { if (null == message) message = ""; logger.debug(message + ":" + formatTime(System.currentTimeMillis())); }