Open kaffarell opened 4 weeks ago
You may need to handle the prefix and suffix before parsing the date (a reverse function of join_date
).
Oh, yeah, you're right. Thanks for the heads up, updated it now. Extracted the the datetime from the prefix/suffix, then converted to PrimitiveDateTime (because OffsetDateTime also takes a offset), then just assume it's utc (this is fine, because we also do this when writing AFAIK).
The prefix or suffix can also contain a dot.
Damn, forgot about that. Should work now!
Third time's the charm :) LMK what you think now!
replacen
can occur within a string. We must ensure they are strictly prefixes or suffixes.
What do you mean exactly, could you paste an example? If the logfile prefix given is not actually the prefix in the filename, we will get a wrong date string and the parsing will fail, but this is intended.
I think you could have suffix 2024
and then files like prefix-2024-01-01-2024
will get turned into -01-01-2024
.
Oof, right. I could reverse the suffix and the whole filename string and then search through? Like that I would always get the first substring from behind. AFAIK rust doesn't have a function to make it more convention ...
Wouldn't strip_prefix
and strip_suffix
work instead of replacen
?
When using the linux-musl target for rust, the file creation time cannot be retrieved, as the current version does not support it yet ( This will be fixed with ^0). In the meantime, we parse the datetime from the filename and use that as a fallback.
Fixes: #2999