2017-04-26 22:41 GMT+03:00 Vernon Crabtree <
vernon.b...@gmail.com>:
> Correct - using internals is not the best long-term solution.
>
> I know there are well-documented options to flatten certain keywords in
> different ways (including WUKS). I am not sure how these work
> under-the-covers, but I think the keywords are first logged to the
> intermediate output file and then filtered out again at the end (I could be
> wrong).
> My reason for wanting to disable logging was primarily for performance but
> also to try to get a clean log - so it is essential to stop the logging in
> the first place.
I assume that with "stop the logging" you mean stopping writing
`<kw></kw>` tags, which is essentially the same what using `--flatten`
does after the fact, and not stopping logging keyword messages? The
latter is something you can already now accomplish by using the
special log level `NONE`, and I'd like to keep this flattening and
actual message logging separate also in the future.
> I like the idea of Robot not logging when there is a certain tag.
> 1) I have not seen this tag form before (with 'robot:'). Are there other
> uses?
Such special keyword tags aren't yet widely used. The best example is
`robot:no-dry-run` that was added in RF 3.0.2 [1]. At the same time we
decided to start using the `robot:` prefix with all such tags.
[1]
https://github.com/robotframework/robotframework/issues/2528
> 2) Would this work for both user-defined and library keywords?
Yes, although with normal library keywords it wouldn't really have any
effect. I think this functionality should be applied only to the
keywords executed by the keyword containing the tag, and in this case
only library keywords executing other keywords via
`BuiltIn.run_keyword` would benefit. This can be discussed, though.
> 3) Can this be made so that it applies to all keywords called by the
> user/library keyword as an option (maybe have 2 tags something like:
> "robot:flatten" and "robot:flatten-recursive"
In my opinion it should automatically be applied to all keywords below
the keyword that has the tag. Additional tag to disable flattening
(e.g. `robot:no-flatten`) could be considered but I doubt it would be
useful.
> I am happy to help out with design/implementation - please point me in the
> right direction to start.
The first step is submitting an issue. We can then continue discussing
about the design in its comments and have everything in the same
place.
> I also wanted to be able to programmatically re-enable the logging when
> something goes wrong for better error handling and reporting useful
> information - although I have not done so yet.
As I already wrote, I'd like to keep flattening the keyword structure
(i.e. not writing `<kw></kw>` tags) and general logging separate. When
you flatten, you don't lose any information except the original
keyword structure. If you disable logging altogether, then valuable
information can be lost, but I'd like to keep that separate from
flattening.
> What I have not yet implemented in my small trial library is an option to
> enable all logging for diagnostic purposes. If we can build this into Robot
> Framework I would want to add this somehow too (maybe a command-line option
> to not flatten).
If flattening is enabled with keyword tags, you could specify a tag
using a variable like
*** Variables ***
${FLATTEN} robot:flatten
*** Keywords ***
Example
[Tags] ${FLATTEN}
and then override it from the command line like `--variable FLATTEN:no-flatten`.
Cheers,
.peke