-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Common log interface #776
Common log interface #776
Conversation
@LarsAsplund Will handle the ability to redirect outputs to different files? OSVVM does not currently have mocking (for various reasons), but I thought if I were to add it, it would be a scoreboard that would receive the redirected output that was destined to a file. I would like to maintain the ability to filter using |
@JimLewis With the current interface one would have to make one call for each output. Given that we working on the lowest level with little data transformation it shouldn't be much overhead doing it twice. In VUnit the formatting can also be different between stdout and file. For example, the file can have a CSV format for easier post-processing but CSV is probably never used for stdout which is intended for human reading. |
@JimLewis I had a look at handling logging hierarchies. VUnit includes the hierarchy in the log, for example 0 fs - top:bottom - INFO - Hello from VUnit hierarchy while OSVVM do not %% Log ALWAYS in bottom, Hello from OSVVM hierarchy at 0 ns This means that VUnit cannot extract the hierarchy when receiving OSVVM messages. That can be handled by requiring that For OSVVM you might not want the overhead of creating a hierarchical name if you don't intent to show it in your native implementation. A way to handle this is to include a deferred constant in the package constant is_original_pkg : boolean; Your native package body would set this value true while all third party implementations are required to set this false. The calling |
@JimLewis WRT to %%. You would always pass the prefix as one of the nameless parameters to |
@LarsAsplund Does your proposed sharing include any sharing of counts and such? |
@LarsAsplund Currently OSVVM bins do not report their parent in printing - but they do know their parent. |
Is this a sensible requirement? Both OSVVM and VUnit do require VHDL 2008 for the intermediate and advanced HDL features. If using unconstrained arrays of strings might produce a better quality code and potentially better functionality, I believe it is acceptable to require VHDL 2008.
I think it is ok to have log_source_name be the full hierarchy name. Furthermore, @JimLewis said the info is available already, although not used. |
@LarsAsplund I see only two ways:
Are you working on 2? |
@JimLewis, why is counting required in order to handle printing messages to screen and/or to files? I believe this is unrelated to VCs, and it's not meant to replace the logging functionality of VUnit or OSVVM. It's just about being able to forward info, warning and error messages from one framework to the other. |
@JimLewis @umarcor I think we're starting to fall into the trap of being over-ambitious in the first step (me included). My goal is to:
To keep the ambition low for the first step I think we shouldn't do more than is needed to maintain the same level of functionality we have today. My last suggestion on how we could have hierarchical information from OSVVM is really something for a future step as that is more information than OSVVM needs for its current implementation. For now we have to cope with what is available and I think it will take us far as my initial examples suggest. Same thing with error counters. We both have them but that is at a higher and more ambitious abstraction level and that will inevitably lead to more things that have to be agreed upon. If I recall correctly error count stop levels don't work the same ways in our systems and the extent to which we use counters are different. VUnit's default behavior is to stop on the first error while OSVVM don't (right?). Such issues complicate things and should be addressed in a separate step. Even if we never get passed the first step I think it has value on it's own so there is no reason to speculate on what we can agree on in the future. |
@LarsAsplund, agree, word by word. |
7bf8576
to
37fd6b3
Compare
37fd6b3
to
e76671f
Compare
I've cleaned up this work and now there is an interface that can be used to redirect VUnit logs into other logging frameworks. The only difference is that I removed the I've also added an OSVVM integration example showing this in practice (https://github.com/VUnit/vunit/tree/common_log_interface/examples/vhdl/osvvm_log_integration). That example also includes a modified AlertLogPkg.vhd and an implementation of the interface that redirects OSVVM logs to VUnit. That is just a proof of concept and not intended for real use. OSVVM has several places producing log messages and I have not converted all of them to use the new interface. That is something that has to be provided and maintained in the OSVVM project. I've opened an issue for that (OSVVM/OSVVM#80) but will make a VUnit release regardless of the progress of that issue. |
Some years ago we had discussions with @JimLewis about creating a logging library common to VUnit and OSVVM. In the end we couldn't come to a solution that provided a value exceeding the costs of making the required and somewhat disruptive changes.
Some days ago we had a discussion if it was possible to do a much less ambitious integration that still provide some significant value. The idea is that we should investigate if we can allow log messages to be piped from one framework to the other by redirecting data at the lowest level.
At the lowest level we have a number of data items that are transformed into a line written to file or stdout. If the procedure doing that transformation is placed in a standalone package it is possible to provide an alternative implementation that passes the data set to another logging system such that logging output becomes consistent for the user. Simple principle that provides some user value. If this is successful we could consider higher levels of integrations in the future but the key is that we do so in small steps rather than going for the complete integration in one big step.
A drawback with the low-level integration is that the data sets are not the same which means that the representation of the data in the "other" system is done on a best effort basis. However, many of the core data items are the same or very similar. For example, time, "log level", the actual message, and the named source of the log message.
Note that alert/checks are just log messages with some extra actions. They are also within the scope of this discussion.
Providing alternative implementations is something that is possible already today. The purpose of this PR is to investigate how this can be made easier by isolating related functionality. By sharing a common concept for this we also provide a clear statement that we endorse such an approach and it isn't against the intentions of the frameworks.
What I've done so far is to create a prototype to get a feel for what such a shared concept may look like. The transformation of the data set to a log line has been encapsulated in a single package containing a single procedure:
Some highlights:
str_x
parameters. I'm not sure about these nameless inputs since it's bad programming style although alias can be used within the procedure implementation to clarify what the parameters are used for. An alternative is allow each framework to add as many named parameters as they like. Better looking code but the interface can't be provided by an external shared repository so the statement of supporting this approach is less obvious.mode
. The idea is that the frameworks have modes that affect how the data set is represented and the nameless parameters can also be given different meaning depending on mode. However, in general one mode may not be sufficient so maybe we should just hide any mode in the set of nameless parameters.In this commit I created an example VUnit testbench that calls both VUnit and OSVVM log/alert/check:
The output today looks like this in GHDL
In this case OSVVM and VUnit have their default implementations of
common_log_pkg
. If I replace the OSVVM implementation with one piping OSVVM logs/alerts to VUnit I get.Someone not using VUnit for compilation would simply update the list of files to compile but in this commit I also added an extra argument to the method including OSVVM in the project
Similarily, the VUnit log/checks could be made looking like OSVVM or any other logging system by replacing the VUnit default implementation of
common_log_pkg
. To do that I added an extra argument to theadd_builtins
method:The result when doing so is
I've taken some short cuts in this first commit. For example,
write_to_log
. For example the lastFAILURE
is from VUnit and is still always logged VUnit styleI think this is just a matter of doing the work. I don't see that the concept shouldn't work for this. For now I'm mostly interested in comments on the basic concept to see if this can lead somewhere.