1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-27 20:45:56 +00:00

maillog: Introduce a special-purpose mail logging package

The default INFO logs are more oriented towards debugging and can be
a bit too verbose when looking for high-level information.

This patch introduces a new "maillog" package, used to log messages of
particular relevance to mail transmission at a higher level.
This commit is contained in:
Alberto Bertogli
2016-10-16 17:52:10 +01:00
parent cda11e03a5
commit febe96697a
20 changed files with 350 additions and 32 deletions

View File

@@ -70,6 +70,10 @@ func Load(path string) (*Config, error) {
c.DropCharacters = "."
}
if c.MailLogPath == "" {
c.MailLogPath = "<syslog>"
}
return c, nil
}
@@ -84,4 +88,5 @@ func LogConfig(c *Config) {
glog.Infof(" Data directory: %s", c.DataDir)
glog.Infof(" Suffix separators: %s", c.SuffixSeparators)
glog.Infof(" Drop characters: %s", c.DropCharacters)
glog.Infof(" Mail log: %s", c.MailLogPath)
}

View File

@@ -68,13 +68,19 @@ type Config struct {
// Suffix separator, to perform suffix removal of local users.
// For example, if you set this to "-+", email to local user
// "user-blah" and "user+blah" will be delivered to "user".
// Default: none.
// Including "+" is strongly encouraged, as it is assumed for email
// forwarding.
// Default: "+".
SuffixSeparators string `protobuf:"bytes,9,opt,name=suffix_separators,json=suffixSeparators" json:"suffix_separators,omitempty"`
// Characters to drop from the user part on local emails.
// For example, if you set this to "._", email to local user
// "u.se_r" will be delivered to "user".
// Default: none.
// Default: ".".
DropCharacters string `protobuf:"bytes,10,opt,name=drop_characters,json=dropCharacters" json:"drop_characters,omitempty"`
// Path where to write the mail log to.
// If "<syslog>", log using the syslog (at MAIL|INFO priority).
// Default: <syslog>
MailLogPath string `protobuf:"bytes,11,opt,name=mail_log_path,json=mailLogPath" json:"mail_log_path,omitempty"`
}
func (m *Config) Reset() { *m = Config{} }
@@ -89,24 +95,25 @@ func init() {
func init() { proto.RegisterFile("config.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 296 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0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0x02,
0x2f, 0xc1, 0xb0, 0x34, 0xf6, 0x1c, 0x77, 0x71, 0xf1, 0x95, 0xe6, 0x5d, 0xf8, 0x04, 0x86, 0x3e,
0x12, 0xf6, 0x57, 0x9b, 0x70, 0x8d, 0x67, 0xc3, 0x38, 0xda, 0xc9, 0xaf, 0xbe, 0x1c, 0x43, 0x7a,
0x46, 0xb2, 0xb8, 0x15, 0x09, 0x8e, 0x65, 0xf1, 0x82, 0x61, 0x57, 0x17, 0xe0, 0xe8, 0x0d, 0xc1,
0xe7, 0xd4, 0x35, 0x6c, 0xb8, 0x57, 0xad, 0x70, 0x02, 0x07, 0xf5, 0x6c, 0x14, 0x9d, 0xc9, 0x36,
0x58, 0xf6, 0x1c, 0x37, 0x7c, 0x24, 0x9d, 0x6d, 0x79, 0xb5, 0x42, 0x52, 0x05, 0x85, 0x2a, 0x89,
0xea, 0x61, 0x87, 0xe7, 0x3d, 0x2d, 0xd3, 0xf8, 0x71, 0xf7, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff,
0xd1, 0x68, 0xa2, 0x22, 0xc8, 0x01, 0x00, 0x00,
// 317 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x91, 0xdf, 0x4e, 0xc2, 0x30,
0x14, 0xc6, 0x83, 0x53, 0xfe, 0x14, 0x50, 0x68, 0x34, 0x56, 0xaf, 0x90, 0x1b, 0x4d, 0x8c, 0xde,
0x18, 0xe3, 0x35, 0xc2, 0xa5, 0x26, 0x06, 0x1e, 0xa0, 0xe9, 0x58, 0x19, 0x27, 0x59, 0xdb, 0xa5,
0xad, 0x06, 0x7d, 0x4d, 0x5f, 0xc8, 0xb3, 0x83, 0x0e, 0x13, 0xbd, 0x3c, 0xbf, 0xef, 0x77, 0xb6,
0x6f, 0x67, 0xac, 0xb7, 0x74, 0x76, 0x05, 0xf9, 0x6d, 0xe9, 0x5d, 0x74, 0xe3, 0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, 0x7c, 0x94, 0x79, 0x57, 0xca, 0xe5, 0x1a, 0xc9, 0x32, 0x6a, 0x54,
0x19, 0xa9, 0x87, 0x15, 0x9e, 0xd6, 0x94, 0x8f, 0x59, 0x9f, 0x9a, 0x16, 0x2e, 0x97, 0xa5, 0x8a,
0x6b, 0xd1, 0x25, 0xad, 0x5b, 0xc1, 0x27, 0x97, 0xbf, 0x20, 0x4a, 0x9b, 0xf4, 0x73, 0xef, 0xbe,
0x02, 0x00, 0x00, 0xff, 0xff, 0x04, 0x0f, 0xa4, 0xff, 0xec, 0x01, 0x00, 0x00,
}

View File

@@ -59,5 +59,10 @@ message Config {
// "u.se_r" will be delivered to "user".
// Default: ".".
string drop_characters = 10;
// Path where to write the mail log to.
// If "<syslog>", log using the syslog (at MAIL|INFO priority).
// Default: <syslog>
string mail_log_path = 11;
}