Skip to content

Commit

Permalink
fix: Fix release workflow (#24)
Browse files Browse the repository at this point in the history
* Set the log level to the min between STDOUT and file

* fix: Add contents:write permission to release workflow (#14)
  • Loading branch information
artyom-morozov authored Jul 25, 2024
1 parent 161fcc9 commit 99af925
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
permissions:
id-token: write
checks: write
contents: write

jobs:
release:
Expand Down
19 changes: 9 additions & 10 deletions src/solace_ai_connector/common/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
import logging.handlers


log = logging.getLogger("mylog")
log.setLevel(logging.DEBUG)
log = logging.getLogger("solace_ai_connector")


# Function to setup the configuration for the logger
def setup_log(logFilePath, stdOutLogLevel, fileLogLevel):
# Set the global logger level to the lowest of the two levels
log.setLevel(min(stdOutLogLevel, fileLogLevel))

stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.setLevel(stdOutLogLevel)
stream_formatter = logging.Formatter(
'%(message)s')
stream_formatter = logging.Formatter("%(message)s")
stream_handler.setFormatter(stream_formatter)

#file_handler = logging.handlers.TimedRotatingFileHandler(
# file_handler = logging.handlers.TimedRotatingFileHandler(
# filename=logFilePath, when='midnight', backupCount=30, mode='w')
file_handler = logging.FileHandler(
filename=logFilePath, mode='w')
file_formatter = logging.Formatter(
'%(asctime)s | %(levelname)s: %(message)s')
file_handler = logging.FileHandler(filename=logFilePath, mode="w")
file_formatter = logging.Formatter("%(asctime)s | %(levelname)s: %(message)s")
file_handler.setFormatter(file_formatter)
file_handler.setLevel(fileLogLevel)

log.addHandler(file_handler)
log.addHandler(stream_handler)

0 comments on commit 99af925

Please sign in to comment.