Skip to main content

ZeroC Ice logging utils

logging.conf example

# https://docs.python.org/3.6/library/logging.config.html
#
# Level               Numeric value
# CRITICAL      50
# ERROR         40
# WARNING       30
# INFO          20
# DEBUG         10
# NOTSET        0
# higher level - less logs

[loggers]
keys=root

[handlers]
keys=consoleHandler

[logger_root]
level=DEBUG
handlers=consoleHandler

[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=consoleFormatter
args=(sys.stdout,)

[formatter_consoleFormatter]
class=ice_yml_log_formatter.YAMLLogFormatter
format=[%(levelname)s] %(name)s: %(msg)s
datefmt=

simple usage example

import os
import logging.config
import logging

logging.config.fileConfig('./logging.conf')

#....
#....
# in your ice servant method
try:
  raise Exception('Any cause')
except:
  logging.exception('Oops!',
                    extra={
                      'ice_current': current,
                      'context': {
                        'any_info_key': 'any info value',
                      },
                    })

Use ice_current for ice request metatada print, and context for extra structured information.

log example

[DEBUG] services.fun - Dispatch
  iceIdentity: ZeroC/Fun
  iceOperation: something
  iceRequestId: 1

[ERROR] services.fun - Unexpected error
  iceIdentity: ZeroC/Fun
  iceOperation: something
  iceRequestId: 1
  context:
    any_info_key: any info value
  Error: Fun::ExampleException
    error_data:
      some_prop: 1
    stack_trace:
      File "path-to-source/fun.py", line 71, in wrapped
        return method(self, *args, **kwargs)

      File "path-to-source/fun.py", line 123, in something
        raise Fun.ExampleException(some_prop=1)

Metadata

Release files for ice-yml-log-formatter 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ice-yml-log-formatter 0.1.2
File Size Uploaded Provenance Actions
ice-yml-log-formatter-0.1.2.tar.gz 4.2 kB Without provenance Details for ice-yml-log-formatter-0.1.2.tar.gz

Release files / ice-yml-log-formatter-0.1.2.tar.gz

Download URL ice-yml-log-formatter-0.1.2.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6ae46e4341f334defc8fe49f0e1ad33144735ec0439a0c3269a904bd8d0bd735
BLAKE2b-256 checksum
How to use checksums
a52875cec642529aa9c55b5fb88c8f1cb4f6dc36ec2814b82ea3de6fa0b8e71e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ice-yml-log-formatter 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page