Read what a log has gained
log_sinceRetrieve log entries appended since the previous call, with offset-based resume, rotation detection via fingerprint, and optional case-insensitive filtering.
Instructions
Only what a log has gained since you last looked.
Args:
name: A log filename from log_files.
offset: The next_offset from your previous call, or 0 to start at the
beginning. BYTES, not lines — a line count is not a resume point,
because the number of lines you have read is not where the file
continues.
contains: Case-insensitive filter, applied to the new lines only.
fingerprint: The previous call's fingerprint, or omit on the first.
It is how a rotation is detected when the NEW log has already
outgrown your offset — without it that case reads as a quiet
continuation, silently skipping the head of the new run.
NOT A LIVE TAIL, and it cannot be one. Tools here are synchronous and a
game session is process-global state, so a launch blocking for five
minutes is not something another call watches from the side. What this
buys is the read between calls: logs re-reads a file that grows all run,
and this returns the new part.
restarted is the field to check. tModLoader ZIPS the previous run's logs
and starts fresh, so an offset from a run that has since rotated points
past the end of a now-shorter file. Reading there would report an empty log
forever, which looks exactly like a quiet game rather than like a log that
restarted underneath you. When that happens the read begins again at zero
and says so, because handing back the whole file is only correct if the
caller is told why.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| offset | No | ||
| contains | No | ||
| fingerprint | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | Yes | ||
| restarted | Yes | ||
| truncated | Yes | ||
| fingerprint | Yes | ||
| next_offset | Yes |