-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Take timestamp as an argument in Log::Entry initializer #9570
Take timestamp as an argument in Log::Entry initializer #9570
Conversation
I think this is fine, but could you explain a bit the use case? |
Example of a require "logger"
class Logger
protected getter __log_backend : Log::Backend { LoggerBackendBridge.new }
private def write(severity, datetime, progname, message)
level = Log::Severity.parse?(severity.to_s) || Log::Severity::Debug
__log_backend.write Log::Entry.new(
source: progname.to_s,
severity: level,
message: message.to_s,
data: Log::Metadata.new,
exception: nil,
timestamp: datetime, # <- Impossible
)
previous_def
end
end |
This is 👍 from me - In our application stack, we migrated from an in-house logging stack (custom web UI for reviewing telemetry in graphs, statistics, etc.) that was backed by postgres. Starting with 0.34, we moved to an ELK stack, in which we emit logs using the new Another small note, I monkeypatch |
Does it make sense for the timestamp to not be |
Does this needs any further clarifications, or can I get a review so we could get the ball rollin'? |
@Sija It's weekend, probably not many people are reviewing code. |
Plus the core team has an agenda, and these PRs just take time off of that agenda. So they will be reviewed, but with time. |
I reckon that, though I'm sure that a 2 line change won't take too much time off the agenda... |
@Blacksmoke16 Would you open a new issue for discussing the default value? That's a different topic. |
I would prefer if the timestamp is moved to a named argument. If we want to add more data to the entry having timestamp there will be inconvenient. |
fd9c0dc
to
1e6a09d
Compare
@bcardiff Done. Should be GTG now. |
Anything left to do here? |
I want to store re-created
Log::Entries
from another logging system. In order to do so I need to setLog::Entry#timestamp
property, which atm is being set toTime.local
on object creation.