Skip to content

Commit

Permalink
update examples with SOCK_STREAM (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
epsilon-0 authored Dec 13, 2023
1 parent a2f71fc commit 85974eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,29 @@ Usage
logger.setLevel(logging.INFO)
# with default system certificate store
handler1 = TLSSysLogHandler(address=('secure-logging.example.com', 6514), secure=True)
handler1 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
socktype=socket.SOCK_STREAM,
secure=True)
logger.addHandler(handler1)
# with custom certificates, via cafile/capath/cadata
# refer to https://docs.python.org/3/library/ssl.html#ssl.create_default_context
handler2 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
secure=(cafile='/path/to/ca/file'))
socktype=socket.SOCK_STREAM,
secure={cafile='/path/to/ca/file'})
logger.addHandler(handler2)
# with custom SSLContext
context = ssl.create_default_context(cafile='/path/to/ca/file')
handler3 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
secure=context)
socktype=socket.SOCK_STREAM,
secure=context)
logger.addHandler(handler3)
# or allow TLS without verification
handler4 = TLSSysLogHandler(address=('secure-logging.example.com', 6514),
secure="noverify")
socktype=socket.SOCK_STREAM,
secure="noverify")
logger.addHandler(handler4)
logger.info('Hello World!')
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "tlssysloghandler"
version = "1.0.1"
version = "1.0.2"
description = "SysLogHandler with TLS"
readme = "README.rst"
license = {file = "LICENSE"}
Expand Down

0 comments on commit 85974eb

Please sign in to comment.