mirror of
https://github.com/gechandesu/structlog.git
synced 2026-01-23 16:04:14 +03:00
cleanup, use struct update syntax
This commit is contained in:
@@ -4,7 +4,6 @@ import structlog
|
||||
fn main() {
|
||||
// Initialize logger with edited timestamp.
|
||||
log := structlog.new(
|
||||
// timestamp_format: .unix
|
||||
timestamp: structlog.Timestamp{
|
||||
format: .unix
|
||||
}
|
||||
|
||||
@@ -96,8 +96,7 @@ pub fn (r Record) append(field ...Field) Record {
|
||||
mut fields_orig := unsafe { r.fields }
|
||||
fields_orig << field
|
||||
return Record{
|
||||
channel: r.channel
|
||||
level: r.level
|
||||
...r
|
||||
fields: &fields_orig
|
||||
}
|
||||
}
|
||||
@@ -110,8 +109,7 @@ pub fn (r Record) prepend(field ...Field) Record {
|
||||
mut new_fields := unsafe { field }
|
||||
new_fields << r.fields
|
||||
return Record{
|
||||
channel: r.channel
|
||||
level: r.level
|
||||
...r
|
||||
fields: new_fields
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user