pylog Documentation Release nir0s

Similar documents
tolerance Documentation

helper Documentation Release Gavin M. Roy

Kaiso Documentation. Release 0.1-dev. onefinestay

Using SAS Viya Microservices Logging for Performance Analysis of SAS Visual Analytics 8.1 Reports

prompt Documentation Release Stefan Fischer

PyZabbixObj Documentation

databuild Documentation

YouTube API Wrapper Documentation

Swift. Introducing swift. Thomas Woodfin

DevKitchen 2018 Python in Cinema 4D R20

maya-cmds-help Documentation

Pusher Documentation. Release. Top Free Games

python-gmaps Documentation

josync Documentation Release 1.0 Joel Goop and Jonas Einarsson

RPLidar Documentation

lime Documentation Release 0.1 Marco Tulio Ribeiro

WordEmbeddingLoader Documentation

OTX to MISP. Release 1.4.2

cursesmenu Documentation

FriendlyShell Documentation

newauth Documentation

PyDREAM Documentation

Using the YANG Development Kit (YDK) with Cisco IOS XE

mprpc Documentation Release Studio Ousia

px4tools Documentation

Netmiko Documentation

Python Utils Documentation

Kinto Documentation. Release Mozilla Services Da French Team

Avpy Documentation. Release sydh

wm_metrics Documentation

APNs client Documentation

About Python. Python Duration. Training Objectives. Training Pre - Requisites & Who Should Learn Python

python-crfsuite Documentation

nptdms Documentation Release Adam Reeve

Netmiko Documentation

Your Data Visualization Game Is Strong Take It to Level 8.2

Sherlock Documentation

Python Release September 11, 2014

cloudns Documentation

Community detection for NetworkX Documentation

DCLI User's Guide. Data Center Command-Line Interface 2.9.1

Clang Static Analyzer Documentation

tapi Documentation Release 0.1 Jimmy John

python-samplerate Documentation

ers Documentation Release 0.13 ers-devs

redis-lua Documentation

Connexion Documentation

Tagalog Documentation

solrq Documentation Release Michał Jaworski

DCLI User's Guide. Data Center Command-Line Interface

BanzaiDB Documentation

morbo Documentation Release 0.9 Elisha Cook

Archan. Release 2.0.1

Kuyruk Documentation. Release 0. Cenk Altı

calyptos Documentation

bzz Documentation Release Rafael Floriano and Bernardo Heynemann

Junebug Documentation

Python review. 1 Python basics. References. CS 234 Naomi Nishimura

snmp o rmdocumentation

Bitdock. Release 0.1.0

Python Loger Indenter and Helper Documentation

DCLI User's Guide. Modified on 20 SEP 2018 Data Center Command-Line Interface

goose3 Documentation Release maintainers

Mongo Task Queue Documentation

picrawler Documentation

python-docker-machine Documentation

Easy-select2 Documentation

django-modern-rpc Documentation

SAS Event Stream Processing 5.1: Troubleshooting

Basilisk Documentation

.. Documentation. Release 0.4 beta. Author

CSI33 Data Structures

Django-CSP Documentation

pyshk Documentation Release Jeremy Low

Implicit Documentation

django-ratelimit-backend Documentation

streamio Documentation

Feature Forge Documentation

piwikapi Documentation

pyptlib Documentation

PYTHON CONTENT NOTE: Almost every task is explained with an example

Archer Documentation. Release 0.1. Praekelt Dev

Lotus IT Hub. Module-1: Python Foundation (Mandatory)

Python Utils Documentation

sptrans Documentation

Basic Model Interface Documentation

DCLI User's Guide. Data Center Command-Line Interface 2.7.0

Threat Stack Python Client Documentation

json2xls Documentation

Introduction to Python Documentation

Ockle Documentation. Release Guy Sheffer

gettext.js Documentation

django-redis-cache Documentation

pydas Documentation Release Kitware, Inc.

json-rpc Documentation

Python Finite State Machine. Release 0.1.5

g-pypi Documentation Release 0.3 Domen Kožar

Django Graphos Documentation

python-idex Documentation

ramp Documentation Release 0.1 Ken Van Haren

Transcription:

pylog Documentation Release 0.1.4 nir0s August 03, 2014

Contents 1 Quick Start 3 2 Installation 5 3 CLI 7 4 Configuration 9 5 Advanced Configuration 11 6 Formatters 13 7 Transports 15 8 API 17 9 Indices and tables 19 Python Module Index 21 i

ii

pylog Documentation, Release 0.1.4 Contents: Contents 1

pylog Documentation, Release 0.1.4 2 Contents

CHAPTER 1 Quick Start Coming soon... 3

pylog Documentation, Release 0.1.4 4 Chapter 1. Quick Start

CHAPTER 2 Installation Coming soon... 5

pylog Documentation, Release 0.1.4 6 Chapter 2. Installation

CHAPTER 3 CLI Coming soon... 7

pylog Documentation, Release 0.1.4 8 Chapter 3. CLI

CHAPTER 4 Configuration Coming soon... 9

pylog Documentation, Release 0.1.4 10 Chapter 4. Configuration

CHAPTER 5 Advanced Configuration Coming soon... 11

pylog Documentation, Release 0.1.4 12 Chapter 5. Advanced Configuration

CHAPTER 6 Formatters Formatters format the logs. Contents: pylog.formatters.fake_data(data_type) class pylog.formatters.baseformatter(config) Bases: object generate_data() class pylog.formatters.customformatter(config) Bases: pylog.formatters.baseformatter generates log strings in a custom format this is also the the formatter other formatters can rely on to generate application specific logs. see the ApacheAccessFormatter class for reference. generate_data() returns a log string for every item in the format list, if an item in the data dict corresponds with it and the field s data equals $RAND, use faker to fake an item for it. else, choose one item from the list randomly. if there no item in the data to correspond with the format, it will just append to format s field name to the log. example: CustomFormatter : { format : [ name, -, level ], data : { name : $RAND, level : [ ERROR, DEBUG, INFO, CRITICAL ], } } the output of the above example might be: Sally Fields - ERROR or Jason Banks - DEBUG or Danny Milwee - ERROR or... 13

pylog Documentation, Release 0.1.4 class pylog.formatters.jsonformatter(config) Bases: pylog.formatters.baseformatter generates log strings in json format generate_data() returns a json string all fields in the data dict will be iterated over. if $RAND is set in one of the fields, random data will be generate_data for that field. If not, data will be chosen from the list. example: JsonFormatter : { data : { date_time : $RAND, level : [ ERROR, DEBUG ], address : $RAND, } }, the output of the above example might be: { date_time : 2006-11-05 13:31:09, name : Miss Nona Breitenberg DVM, level : ERROR } or { date_time : 1985-01-20 11:41:16, name : Almeda Lindgren, level : DEBUG } # NOQA or { date_time : 1973-05-21 01:06:04, name : Jase Heaney, level : DEBUG } # NOQA or... class pylog.formatters.apacheaccessformatter(config) Bases: pylog.formatters.customformatter class pylog.formatters.apacheerrorformatter(config) Bases: pylog.formatters.customformatter 14 Chapter 6. Formatters

CHAPTER 7 Transports Transports are the methods in which logs are sent. Contents: class pylog.transports.basetransport(config) Bases: object configure() send(client, log) class pylog.transports.udptransport(config) Bases: pylog.transports.basetransport configure() send(client, log) close() class pylog.transports.streamtransport(config) Bases: pylog.transports.basetransport configure() send(client, log) close() class pylog.transports.filetransport(config) Bases: pylog.transports.basetransport configure() send(client, log) close() get_data() class pylog.transports.amqptransport(config) Bases: pylog.transports.basetransport configure() send(client, log) close() 15

pylog Documentation, Release 0.1.4 16 Chapter 7. Transports

CHAPTER 8 API Contents: pylog.pylog.init_logger(base_level=20, verbose_level=10, logging_config=none) initializes a base logger this will use config.py s LOGGER param and log- you can use this to init a logger in any of your files. ging.dictconfig to configure the logger for you. Parameters base_level (int logging.level) desired base logging level verbose_level (int logging.level) desired verbose logging level logging_dict (dict) dictconfig based configuration. used to override the default configuration from config.py Return type python logger pylog.pylog.set_global_verbosity_level(is_verbose_output=false) sets the global verbosity level for console and the lgr logger. Parameters is_verbose_output (bool) should be output be verbose pylog.pylog.get_current_time() returns the current time pylog.pylog.calculate_throughput(elapsed_time, messages) calculates throughput and extracts the number of seconds for the run from the elapsed time Parameters elapsed_time run time messages (int) number of messages to write Returns throughput and seconds Return type tuple pylog.pylog.send(instance, client, format, format_config, messages, gap, batch) sends logs and prints the time it took to send all logs Parameters instance transport class instance client client to use to send logs format (string) formatter to use 17

pylog Documentation, Release 0.1.4 format_config (dict) formatter configuration to use messages (int) number of messages to send gap (float) gap in seconds between 2 messages batch (int) number of messages per batch pylog.pylog.config_transport(transports, transport, transport_config) returns a configured instance and client for the transport Parameters transport (string) transport to use transport_config (dict) transport configuration pylog.pylog.generator(config=none, transport=none, formatter=none, gap=none, messages=none, batch=false, verbose=false) generates log messages this will generate log message in the requested format and protocol. Parameters config (string) path to config file path transport (string) transport type to use formatter (string) formatter to use gap (float) gap in seconds between 2 messages messages (int) number of messages to send pylog.pylog.list_fake_types() prints a list of random data types with an example exception pylog.pylog.pylogerror Bases: exceptions.exception 18 Chapter 8. API

CHAPTER 9 Indices and tables genindex modindex search 19

pylog Documentation, Release 0.1.4 20 Chapter 9. Indices and tables

Python Module Index p pylog.formatters, 13 pylog.pylog, 17 pylog.transports, 15 21