Comments (4)
Logging
This is a suggestion how we should implement logging in command line tools.
Note that the commands and their output here might be fictional.
Configuration
We should be using our service logging level conventions as a base, using the same terminology as well as their definitions:
https://core.qlik.com/conventions/logging/#logging-level-definitions
One additional level could be added if we seem fit: SILENT.
The numeric mapping would be:
Level | Numeric |
---|---|
TRACE | 6 |
DEBUG | 5 |
INFO | 4 (default) |
WARN | 3 |
ERROR | 2 |
FATAL | 1 |
SILENT | 0 |
corectl --log-level 6 reload --app foo.qvf
LOG_LEVEL=TRACE corectl --app foo.qvf
The environment variable is useful in e.g. Circle CI to avoid modifying scripts that already runs corectl commands.
Output
The output should, at minimum, be designed for humans. This means plain english and no too cryptic log formats.
In addition, it would be useful to support logging in different formats:
Human readable
corectl reload --app foo.qvf
[06:34:35] WARN: No --app defined, will use an session app instead.
[06:34:35] INFO: Reload started.
[06:34:38] INFO: Reload successful.
JSON
This format could (with benefit) use the logging conventions JSON output, but perhaps defined as an JSON array.
corectl reload --app foo.qvf
[
{
"timestamp": "2018-09-27T06:34:35.455Z",
"logseverity": "WARN",
"message": "No --app defined, will use an session app instead."
},
{
"timestamp": "2018-09-27T06:34:35.715Z",
"logseverity": "INFO",
"message": "Reload started."
},
{
"timestamp": "2018-09-27T06:34:38.119Z",
"logseverity": "INFO",
"message": "Reload successful."
}
]
from corectl.
I have looked into adding a logging framework in corectl for logging in either plain text and json.
Since we are aiming for being able to customize the output e.g. log keys, format of timestamps and log levels there are atleast two suitable options:
Switching to using either of these framework for logging standard messages (INFO, DEBUG, FATAL etc.) or json traffic from our modules seems doable in a small timeframe. I have a branch where I have started the work on using logrus
here.
As I see it there is two bigger tasks that needs to be resolved/discussed before we choose either of these options:
- How should we handle
Table
printouts for e.g. an app list in plain text. Should this be printed direcly tostdout
, through the logger or be removed? Passing it through the logger seems quite tricky with either of the options above. - Currently we are using
golden
files for integration tests which means that we assert on the printouts from the tool. With a logger adding timestamps this approach can no longer be used, unless we make it the timestamp optional on e.g. a test env variable. We can also change all the test cases to only assert on specific strings in the output, but that will lead to less verification.
from corectl.
Removing the v1
label on this issue since it is no longer in the scope of the first release.
from corectl.
I think we should revisit this issue!
from corectl.
Related Issues (20)
- Don't always add the generic error message
- Connecting through proxy to insecure sense HOT 2
- Sense Enterprise requires `engineData` in wsURL HOT 2
- Unbuild has undeterministic output HOT 6
- No error when corectl fails to set a loadscript
- Approving and publishing objects via corectl HOT 3
- Dependency sheet visibility on data reload after build/unbuild HOT 2
- app properties do not come with an unbuild-build with corectl HOT 2
- Incorrect version in spec after a release HOT 1
- migration hash prevents publishing
- Strange parsing in corectl.yml file in connectionstring HOT 1
- Special characters not unbuilding correctly HOT 4
- Replacing an app with a build does not replace the app HOT 4
- Migration hash issue
- Sheets with the same name
- Content library references are automatically changed to in-app references for desktop installation HOT 2
- Eval function output to json HOT 1
- No sheets titles in app object ls functions HOT 1
- Update bash completion to work with latest cobra functionality
- Investigate why parameter location has a value "body".
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from corectl.