-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implement table log monitor #8
base: master
Are you sure you want to change the base?
Conversation
Very interesting. @info "" table=(
Name = (@sprintf "%35s" row.Name),
Year = row.Year,
var"Miles per Gallon" = row.Miles_per_Gallon,
) _id=:outer I've been wondering about content vs presentation here. In particular, should we be able to take records from someone who didn't anticipate structuring the logs as a table and put them into tabular form? I feel like we should, so you could just do @info "" Name=(@sprintf "%35s" row.Name) Year=row.Year var"Miles per Gallon" = row.Miles_per_Gallon But of course the backend then needs some fancy configuration to set up formatting for this particular record which is annoying and difficult. Another vague thought I've had is that the frontend That |
I think it makes sense to treat as an API contract that More practically, how do we mix table and normal logging with the "flat" message like using Logging
using TerminalLoggers
with_logger(TerminalLogger()) do
@info "" table=(
var"First column" = rand(1:9999),
var"Second column" = rand(1:9999),
) _id=:table1
@info "" table=(
var"First column" = rand(1:9999),
var"Second column" = rand(1:9999),
) _id=:table1
@info "" table=(
var"Third column" = rand(1:9999),
var"Fourth column" = rand(1:9999),
) _id=:table2
@info "Some message" alpha=rand() beta=rand()
@info "" table=(
var"First column" = rand(1:9999),
var"Second column" = rand(1:9999),
) _id=:table1
@info "" table=nothing _id=:table2
@info "" table=nothing _id=:table1
end prints
I think it's important that we still can print non-table logs. Also, it's not difficult to transform "flat" messages to
This is something I've been wondering: do we want an "open" API or a "centralized" API? For progress logging, "open" API is something like the current situation that the frontend and backend just need to follow some specification. By "centralized" API, I mean it's something like JuliaLogging/ProgressLogging.jl#7 (comment) where you need to use a particular type for the
It's pretty handy! Thanks a lot for implementing this :) |
Here is a screen capture: Codeusing Logging
using TerminalLoggers
using VegaDatasets
using Tables
using Printf
using ProgressLogging
with_logger(TerminalLogger()) do
limit = 10
@progress for (i, row) in enumerate(Iterators.take(Tables.rows(dataset("cars")), limit))
@info "" table = (
Name = (@sprintf "%35s" row.Name),
Year = row.Year,
var"Miles per Gallon" = row.Miles_per_Gallon,
) _id = :outer
sleep(0.5)
for key in propertynames(row)
if key ∉ (:Name, :Year, :Miles_per_Gallon)
@info "" table = (
Variable = (@sprintf "%20s" key),
Value = getproperty(row, key),
) _id = :inner
end
sleep(0.01)
end
if i % 3 == 0
@info "Non-table message example." i
elseif i % 4 == 0
@info "" table = nothing _id = :inner
@info "Removed the inner table."
sleep(1)
end
end
@info "" table = nothing _id = :inner
@info "" table = nothing _id = :outer
end |
Yes, a very good question. We seem to have several possible designs which are quite different for this stuff.
Many difficulties come down to the fact that there's a flat namespace of keys with no separation between those which have some systematic semantic vs those which can be arbitrarily used by users to attach metadata they think "might be interesting". |
Just for completeness, I think another option is to not use logging in the first place. I commented it in Discourse https://discourse.julialang.org/t/different-logging-output-between-juno-execute-and-julia-repl/30933/10 |
I think the system would have failed in its design goals if everyone needs to implement their own disparate APIs for filtering, routing, and display event streams. But it's certainly possible to fail! As I said on discourse, it could be useful to try a separate progress logging system to get a feeling for what we're missing, if anything. Ultimately I would hope we can just add in the necessary feature or clarify the semantics of logging to cover the progress logging case better. |
@@ -93,7 +101,7 @@ function showsticky(io, prev_nlines, messages) | |||
nothing | |||
end | |||
|
|||
function Base.push!(sticky::StickyMessages, message::Pair) | |||
function Base.push!(sticky::StickyMessages, message::Pair; first=true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this again now, I realize that it'd be better to overload push!
and pushfirst!
.
Hi, What is the state of this? |
#4 needs to go first, but this already (somewhat) works.
Example:
Output: