Skip to main content

A client for CodeTitans Odysseus Logging Platform.

Project description

Odysseus Platform - Python client

This repository contains full source code of the simple Python project capable of uploading log entries or events happening on a backend application - back to the Odysseus Logging Platform.

Once it's added as a dependency of your Python application, it has to be connected with your existing logging system and logs serialization has to be redirected to be able to process them and pass back to the server.

Official home of this package on pypi.org is Odysseus Client.

Disclaimer

Full utilization of the Odysseus Logging Platform services is subject to the proper contract and not part of that client functionality. By using this software you essentially agree that since it's an open-source project you read it and understand all repercussions of using it. Thus you will never claim or call for any compensations or damages in connection with downtime of your own services caused by this software.

Logging Levels

In general all parameters exposed by the library are self-explanatory. The only one that could potentially be a source of questions is the log level. Here are the values then expected with a proper meaning (originally based on ASP.NET Log Levels)

Value Name Description
0 Trace Lowest level, should be used only during development, cause it can potentially print some sensitive info.
1 Debug Typical debugging information with detailed information.
2 Info Mid-level debugging, just general information about activity
3 Success Mid-level debugging, just successful information about activity
4 Warn Logs that describe unexpected and abnormal behavior, potentially some unexpected behaviors happening on other components.
5 Error All kids of errors that prevent the application to continue its operation.
6 Critical Logs of unrecoverable behaviors of the application, including crashes, lack of local disc-space and everything that requires immediate attention of the administrator.

Usage

It's extremely easy to integrate CodeTitans Odysseus Client package with your own project. The client being part of this package has only a single capability to upload any logs entries or custom events back to the backend and correctly identify them online. Follow these 3 simple steps to complete the setup:

  1. Install this package into your current environment:

    $ python3 -m pip odysseus
    
  2. Inside your project import the client class inside your own logging part of the application.

    from odysseus import OdysseusClient
    
  3. Initialize the client with proper credentials, that were given to you, when registered your backend service at Odysseus Logging Platform

    # ...
    # assuming here is your own logging system that captures activities across the whole application
    # initialize the client with received credentials
    
    odysseus = OdysseusClient(app_id='app_XXX', app_key='<key>')
    
  4. Potentially highjack the logging function

    def log_entry(level: LogLevel, tag: str, message: str) -> LogEntry:
    
        # ... other application code removed for clarity ...
        odysseus.log(message=message, severity=LogSeverity(level.value), tag=tag, timestamp=datetime.now(tz=timezone.utc))
    

    also add a helper method for sending events:

    def log_event(name: str, data: Optional[Dict[str, Any]] = None, type: int = 0,
                  stream_id: Optional[UUID] = None, position: Optional[int] = None, meta: Optional[Dict[str, Any]] = None):
        odysseus.event(name=name, data=data, type=type, stream_id=stream_id, position=position, meta=meta)
    

Examples

As described in the chapter above, usage of this logging client would be as easy as calling the two helper functions:

# log regular message
log_entry(LogLevel.DEBUG, __tag, 'Invoking presentation request')

# or logging an event
log_event('invoicing-started', {'requested-for': company.id, 'ref': order.id, 'amount': order.sum_netto})

CodeTitans Sp. z o.o. (2025-)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odysseus-0.1.6.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odysseus-0.1.6-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file odysseus-0.1.6.tar.gz.

File metadata

  • Download URL: odysseus-0.1.6.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for odysseus-0.1.6.tar.gz
Algorithm Hash digest
SHA256 559cb177adb537b31a23fcb280c57dc616236c36464804a0c56038cc56a5b837
MD5 78613bd684040969bb33dd8e5dc662d0
BLAKE2b-256 3baee65850812a5d7212db36edc6de13117e37fa0704d3026bf567f7d80262d4

See more details on using hashes here.

File details

Details for the file odysseus-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: odysseus-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for odysseus-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 68e1e1012619e9d3ea3a209c707a78e18b970c34767a77affbf8044252dd02fd
MD5 8a206e603e583fd500fe89d6becfdebc
BLAKE2b-256 e33ff1688b2049f10ae22bfe114ec075993c2728fe184602307a6b798f386755

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page