Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ jobs:
run: |
pytest

- name: Gather Badge Data
if: github.ref_name == 'main' && github.event_name == 'push'
- name: coverage | Test Coverage
run: |
coverage run -m pytest -s
coverage report -m

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3
if: always() && github.ref_name == 'main' && github.event_name == 'push'
if: github.ref_name == 'main' && github.event_name == 'push'
with:
ref: assets
path: assets
Expand Down
17 changes: 10 additions & 7 deletions slack_logger/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ def construct_context(
if config.context != []:
context_msg = ", ".join(config.context)
return ContextBlock(elements=[MarkdownTextObject(text=context_msg)])
elif env is not None and service is not None:
return ContextBlock(elements=[MarkdownTextObject(text=f":point_right: {env}, {service}")])
elif env is None:
return ContextBlock(elements=[MarkdownTextObject(text=f":point_right: {env}")])
elif service is None:
return ContextBlock(elements=[MarkdownTextObject(text=f":point_right: {service}")])
return None
if env is None and service is None:
return None

context: List[str] = []
if env is not None:
context.append(env)
if service is not None:
context.append(service)

return ContextBlock(elements=[MarkdownTextObject(text=f":point_right: {','.join(context)}")])

def format(self, record: LogRecord) -> str:
maybe_blocks: Sequence[Optional[Block]] = self.format_blocks(record=record)
Expand Down