Add documentation.

FossilOrigin-Name: 3f015df490d1df1dd9800a0db1b0aa28d8af6ee688e7a09ba21b8b1e2f58c465
This commit is contained in:
Mahlon E. Smith 2023-07-01 02:15:02 +00:00
parent a7e4efcce9
commit d936909be5
4 changed files with 280 additions and 60 deletions

View file

@ -12,6 +12,7 @@ import
std/monotimes,
std/os,
std/posix,
std/strutils,
std/times
@ -39,13 +40,16 @@ proc createLogger*( parentdir: string, filename: string ): void =
## Get in line to open a write lock to the configured logfile at +path+.
## This will block until it can get an exclusive lock.
let path = joinPath( parentdir, filename )
logger = Logger()
logger.fh = path.open( fmAppend )
logger.start = getMonoTime()
try:
logger = Logger()
logger.fh = path.open( fmAppend )
logger.start = getMonoTime()
# Wait for exclusive lock.
discard logger.fh.getFileHandle.lockf( F_LOCK, 0 )
logger.fh.writeLine "\n", now().utc, " ------------------------------------------------------------------"
# Wait for exclusive lock.
discard logger.fh.getFileHandle.lockf( F_LOCK, 0 )
logger.fh.writeLine "\n", now().utc, " ------------------------------------------------------------------"
except IOError as err:
echo "Unable to open logfile: $#" % [ err.msg ]
proc close*( l: Logger ): void =

View file

@ -48,7 +48,70 @@ const
Display version number.
"""
EXAMPLECONFIG = """
sdfdsfsdfsdfsdfdsfdf FIXME: FIXME WJSDFJKSDFKSDF
#
# Example Sieb configuration file.
#
# This file performs no actions by default, edit to taste.
#
## Rules tried before global filtering is applied.
## You can use this section to deliver before a spamfilter, for example.
##
# early_rules:
#
# # Mail that is both from me and to me is questionable....
# -
# match:
# from: mahlon@martini.nu
# # Magic "TO" which means To: OR Cc:
# TO: mahlon@martini.nu
# filter:
# - [ reformail, -A, "X-Sieb: I sent mail to myself?" ]
# deliver: .suspicious
#
# # No need to spam filter from the FreeBSD mailing list
# -
# match:
# list-id: .*freebsd-questions.*
# deliver: .freebsd
## Global filtering. All incoming mail that didn't match an "early rule" gets
## this treatment.
##
# filter:
# - [ bogofilter, -uep ]
## Normal rules, after the global filtering.
## Multiple matches are AND'ed. Everything is case insensitive.
##
## Delivery default is ~/Maildir, any set value is an auto-created maildir under
## that path.
##
# rules:
# # More mailing lists, after filters
# -
# match:
# list-id: .*lists.linuxaudio.org.*
# deliver: .linuxaudio
#
# # Bye, spam. (Custom bogofilter header?)
# -
# match:
# x-spamfilter: \+
# deliver: .spam
#
# # Just filter the message and deliver to default.
# -
# match:
# x-weird-example: hey, why not
# filter:
# - [ reformail, -A, "X-Sieb: Well alright then" ]
"""
#############################################################