Skip to content

Conversation

@valepakh
Copy link
Contributor

return runPipelineInternal();
} finally {
if (verbose) {
CliLoggers.redirectOutput(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CliLoggers.redirectOutput(null); looks strange. It could be read as "redirect logger output to nothing" that might give a false illustion that the logger won't write logs at all. But in fact, it writes to log file. I would suggest to add one more method like setDefaultOutput().

private final Flow<I, O> flow;
private final ExceptionHandlers exceptionHandlers;
private final DecoratorRegistry decoratorRegistry;
private boolean verbose;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not final because it's set by the method, not the constructor.

import org.apache.ignite.rest.client.invoker.ApiClient;
import org.apache.ignite.rest.client.invoker.Configuration;

public class CliLoggers {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be useful to add a javadoc that explains why this class exists and when to use it.

CliLoggers.isVerbose = isVerbose;
}

private static void setHttpLogging(boolean isVerbose) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this code should not be located in a class named CliLoggers. We have to rename this class or move this http-related code to a separate class.

private StringWriter errOut;

@Test
void testVerbose() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is good and it would be nice to test CallExcecutionPipeline too. Maybe it could be just a regular command test but with --verbose flag.

@PakhomovAlexander
Copy link
Contributor

LGTM

protected boolean usageHelpRequested;

@Option(names = {"-v", "--verbose"}, description = "Show additional information about errors.")
protected boolean verbose;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always about errors?

ApiClient client = Configuration.getDefaultApiClient();
Builder builder = client.getHttpClient().newBuilder();

builder.interceptors().clear();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't it clear all interceptors when we only want to stop http log?
Also, adding a test checking correct behaviour of this method would be cool

valepakh and others added 2 commits November 1, 2022 12:55
…flow/builder/FlowBuilder.java

Co-authored-by: Semyon Danilov <samvimes@yandex.ru>
Copy link
Contributor

@SammyVimes SammyVimes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SammyVimes SammyVimes merged commit 61c8cb2 into apache:main Nov 2, 2022
@valepakh valepakh deleted the IGNITE-17786 branch November 2, 2022 06:34
ivgag pushed a commit to unisonteam/ignite-3 that referenced this pull request Nov 4, 2022
slukyano pushed a commit to slukyano/ignite-3 that referenced this pull request Nov 7, 2022
lowka pushed a commit to gridgain/apache-ignite-3 that referenced this pull request Mar 18, 2023
lowka pushed a commit to gridgain/apache-ignite-3 that referenced this pull request Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants