Conversation
|
I wonder if we can embed one type within another ( |
Now that I've tried it, embedding introduces more invasive changes than the duplication. I even tried to have a third struct type for the common fields, but same limitation incurred, keyed fields had to be wrapped with the embedded type. The I don't like how invasive this attempt at duplication. I wonder if there's another way by means of an unexported function. In case you want to play with it, here's a working config: {
"logging": {
"sink" : {
"level": "DEBUG",
"encoder": {
"format": "json"
}
},
"logs": {
"default": {
"level": "DEBUG",
"encoder": {
"format": "json"
}
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"localhost"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"body": "Howdy!",
"handler": "static_response"
}
]
}
]
}
],
"terminal": true
}
]
}
}
}
}
} |
|
I highly doubt any plugin is directly using the |
d488e7f to
3c73b68
Compare
How about now? |
francislavoie
left a comment
There was a problem hiding this comment.
Looks great to me 👍
I want Matt's review before merging tho
mholt
left a comment
There was a problem hiding this comment.
Awesome -- yeah, let's give it a try!
sinklogs have, thus far, been printed not encoded in any format. This does not play friendly with log parsers expecting a specific format from a particular source. In other words, it becomes a hassle to tell the log parser, e.g. Loki, Caddy logs are json-formated if some lines aren't.