Skip to main content

PinLog is a powerful driver and library integrated several logging systems.

Project description

PinLog

PinLog is a powerful driver and library integrated several logging systems. It is divided into smallest independent service units and easy to use.

Installation

PinLog can be installed with pip: python -m pip install pinlog

Get Start

Step 1 Import pinlog:

>>> from pinlog import helper
>>> from pinlog.log import Log
>>> from pinlog.helper import Logger, Console, Logstash, Filters

Step 2 Add @Logger above the class

>>> @Logger(Log.Console, Log.Logstash)
>>> @Filters('username', 'firstname', 'middlename', 'lastname')
>>> class MyClass():
...     def __init__(self):
... 
... 

Step 3 Add @Logger above the class

>>> mc = MyClass()
>>> mc.pin('marker1')
>>> time.sleep(3)
>>> mc.pin('marker2')
>>> print("--- %.8f seconds execution ---" % (mc.latency('marker1', 'marker2')))
--- 3.00161195 seconds execution ---

Moreover, you can trace anywhere even if across the applications as below examples

Example of tracing over 2 applications

class1.py - The first application:

from pinlog import helper
from pinlog.log import Log
from pinlog.helper import Logger, Console, Logstash, Filters
import time

@Logger(Log.Console, Log.Logstash)
@Filters('username', 'firstname', 'middlename', 'lastname')
class Class1():
    
    def __init__(self):
        pass

    def function1(self, str):
        pass


c1 = Class1()
c1.pin('marker1')
time.sleep(3)
c1.pin('marker2')

class2.py - The second application:

from pinlog import helper
from pinlog.log import Log
from pinlog.helper import Logger, Console, Logstash, Filters

@Logger(Log.Console, Log.Logstash)
class Class2():

    def __init__(self):
        pass

    def function2(self, str):
        pass

c2 = Class2()
data = {
    'username': 'admin',
    'password': '1qazxsw2',
    'firstname': 'Tom',
    'lastname': 'Cruise',
    'role': 'Administrator',
    'birthdate': 'July 3, 1962',
    'department': 'Cruise/Wagner Productions'
}
output1 = c2.trace('marker1', data)
print('Output 1 : ', output1)
output2 = c2.trace('marker2', data)
print('Output 2 : ', output2)

Output:

Output 1 : {'username': 'admin', 'firstname': 'Tom', 'middlename': None, 'lastname': 'Cruise', 'latency': 13.845938920974731}
Output 2 : {'username': 'admin', 'firstname': 'Tom', 'middlename': None, 'lastname': 'Cruise', 'latency': 10.844847202301025}

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

pinlog-0.2.6.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file pinlog-0.2.6.tar.gz.

File metadata

  • Download URL: pinlog-0.2.6.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.0

File hashes

Hashes for pinlog-0.2.6.tar.gz
Algorithm Hash digest
SHA256 5cd5d17605c7f6c7a7ecc8b45d0c69957a81d37601e064d65082cfc3469de9e1
MD5 0cafefcaacedd220c847de10655bc129
BLAKE2b-256 bbd9896d2dd4185abaa9587393a693afd5af335ac28b114a5fe1199c5059dc50

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