Skip to content
This repository has been archived by the owner on Oct 2, 2022. It is now read-only.

Commit

Permalink
JSON/YAML tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Janos Pasztor committed Mar 8, 2021
1 parent a8f3f77 commit 0fd53a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.13: JSON/YAML tags

This release adds tags to exclude not used fields from the configuration structure.

## 0.9.12: CODES.md generation

This release adds a utility to automatically generate an overview file of all message codes. See the readme for details.
Expand Down
1 change: 0 additions & 1 deletion CODES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
| `LOG_WRITE_FAILED` | ContainerSSH cannot write to the specified log file. This usually happens because the underlying filesystem is full or the log is located on a non-local storage (e.g. NFS), which is not supported. |
| `TEST` | This is message that should only be seen in unit and component tests, never in production. |
| `UNKNOWN_ERROR` | This is an untyped error. If you see this in a log that is a bug and should be reported. |

9 changes: 5 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ type Config struct {
Syslog SyslogConfig `json:"syslog" yaml:"syslog"`

// T is the Go test for logging purposes.
T *testing.T
T *testing.T `json:"-" yaml:"-"`

// Stdout is the standard output used by the DestinationStdout destination.
Stdout io.Writer
Stdout io.Writer `json:"-" yaml:"-"`
}

// Validate validates the log configuration.
Expand Down Expand Up @@ -492,6 +492,7 @@ var nameToFacility = map[FacilityString]Facility{
}

// SyslogConfig is the configuration for syslog logging.
//goland:noinspection GoVetStructTag
type SyslogConfig struct {
// Destination is the socket to send logs to. Can be a local path to unix sockets as well as UDP destinations.
Destination string `json:"destination" yaml:"destination" default:"/dev/log"`
Expand All @@ -503,9 +504,9 @@ type SyslogConfig struct {
Pid bool `json:"pid" yaml:"pid" default:"false"`

// connection is the connection to the Syslog server. Internal usage only.
connection net.Conn
connection net.Conn `json:"-" yaml:"-"`
// tag is the real syslog tag for the message
tag string
tag string `json:"-" yaml:"-"`
}

// Validate validates the syslog configuration
Expand Down

0 comments on commit 0fd53a5

Please sign in to comment.