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 general 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=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.4.tar.gz (9.1 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.4-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: odysseus-0.1.4.tar.gz
  • Upload date:
  • Size: 9.1 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.4.tar.gz
Algorithm Hash digest
SHA256 29ad1dea81026c9785f15a5c7b57982a9fa7d7a88f7e9bc16d157558e8b7216f
MD5 2893fc2537462b1e0c71465f7653351c
BLAKE2b-256 c107b593503f2a7ba5fa7f5f82609fb7f8a35b5d3b5a25cd18b7fd29ff0b3f33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: odysseus-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f4080e3d549a65a4b8c18ed7db469d887f14a2fbb72e73a9b702f30faeac15d8
MD5 0338d2bb526764041d2468ea98c930d6
BLAKE2b-256 11ff41a99e7927e1e6ec9f16da61d41ab9fa0a4ad52b0019ea91e2611a5580b0

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