Saravanan666/pypi-org huggingface dataset:
Package: loguru-loki-handler
loguru-loki-handlersHandler created for Loguru that sends logs to Grafana Loki in JSON formatFeaturesLogs pushed in JSON formatCustom labels definitionAllows defining loguru and logger extra keys as labelsLogger extra keys added automatically as keys into pushed JSONHow to usefromloguru_loki_handlerimportloki_handlerfromloguruimportloggerimportosos.environ["LOKI_URL"]="https://USER:PASSWORD@logs-prod-eu-west-0.grafana.net/loki/api/v1/push"logger.configure(handlers=[{"sink":loki_handler(os.environ["LOKI_URL"],{"application":"Test","envornment":"Develop"}),"serialize":True}])logger.info("Starting service")logger.info("Response code{code}HTTP/1.1 GET{url}",code=200,url="https://loki_handler.io")Loki messages samplesWithout extra{"message":"Starting service","timestamp":1681638266.542849,"process":48906,"thread":140704422327936,"function":"run","module":"test","name":"__main__"}With extra{"message":"Request return 200 HTTP/1.1 GET https://loki_handler.io","timestamp":1681638225.877143,"process":48870,"thread":140704422327936,"function":"run","module":"test","name":"__main__","code":200,"url":"https://loki_handler.io"}Exceptions{"message":"name 'plan' is not defined","timestamp":1681638284.358464,"process":48906,"thread":140704422327936,"function":"run","module":"test","name":"__main__","file":"test.py","path":"/test.py","line":39}Loki Query SampleLoki query sample :{envornment="Develop"} |= `` | jsonFilter by level:{envornment="Develop", level="INFO"} |= `` | jsonFilter by extra:{envornment="Develop", level="INFO"} |= `` | json | code=`200`LicenseThe MIT License
Package: loguru-mypy
loguru-mypyA fancy plugin to boost up your logging withlogurumypy compatibilitylogoru-mypyshould be compatible withmypy>=0.770.
Currently there is no limit as far as the compatibility can go. If you are interested to see
how farloguru_mypygoes you can visitCI/CD actionand check its
matrix.InstallationSimply execute:pipinstallloguru-mypyAnd later on modify yourmypy.iniconfiguration file with[mypy]plugins=loguru_mypyThat is all, your code is now ready to be linted.What is included?loguru-mypyis obviously amypyplugin that allows to avoid
some of those littleruntimetrickeries :).
Here is a short attempt to list some of those:Lazy loggerslogger.opt(lazy=True)in facts returns aloggerthat we calllazy. Lazy loggers accept onlytyping.Callable[[], t.Any]in place of positional or named arguments. Passing a callable that
accepts even asingleargument thus results in runtime error.loguru-mypydetects that fact
and lets you know before your runtime reaches that portion of a code.
Package: loguru-notification
loguru-notificationloguru-notification 是一个日志输出项目，在loguru的基础集成日志输出到控制台、输出到Slack、并结合CMRESHandler把日记记录到ElasticSearch，
更容易的对日志进行分析。Installation1.使用python包管理工具pip进行安装。pipinstallloguru-notificationUsage对loguru-notification进行配置，并输出日志信息。fromconfiglog.setlogsimportLoggerlogger=Logger(webhook_url='Your Slack webhook URL',# Slack webhook URL  # noqaes_host='172.0.0.1:9200',# log on ElasticSearch host ip and port)if__name__=='__main__':logger.printout('输出到控制台')logger.msg('输出到控制台，并写入ElasticSearch')logger.notice('输出到控制台和Slack，并写入ElasticSearch')Contributing欢迎使用，如果有好的优化方法也欢迎提交修改。使用前请做适当的测试，以确定跟您的项目完全兼容。LicenseMIT
Package: logus
Static typed structured loggingDescriptionThis project araised from the need to log backend applications, aws lambdas and other stuff in modern cloud ecosystem. Logging systems today are able easily parsing JSON format out of the box.
Static typing approach brings here consistent way to define key values to final msg, as well as easier following Domain Driven Design, where logs consistently describe what they log. Static typed logging brings easy refactoring to any present logs.FeaturesAccepts static typed components as optional paramsit will not acceptanyoptionshas shortcut WithFields, to make clone of the logger with default logging fieldsEasy to turn on/off parameters by environment variablesAbility to define different log levels for different created loggersEasier turning complex objects into structured loggingaccepts maps and structs as its params. It will parse them on their own.See folder examplesPython specificsIn order to function with python well, recommendation to turn onstrict mypyor pyright in one ofits modsAlternative VersionsVersion in golang
Package: logutil
Logutil(Extremely) easy initialization forloggingandloguruWhyThis packages makes it (extremely) easy to sendloggingandlogurulogs tostreamsfilessentrypushoverslackInstallationLogging only:pip install logutil... + loguru:pip install logutil[loguru]... + pushover/sentry/slack:pip install logutil[notifiers]... + loguru + pushover/sentry/slack:pip install logutil[all]ExamplesStandard python loggingfromlogutilimportinit_logging,get_logging_loggerinit_logging(name='data_feeds',sentry_on=True,sentry_dsn='<your sentry dsn string>',sentry_breadcramp_level='INFO',sentry_event_level='WARNING',)logger=get_logging_logger('data_feeds')logger.info('Test INFO message (logging)')logger.warning('Test WARNING message (logging)')2020-07-19T12:59:18.740Z data_feeds INFO: Test INFO message (logging)
2020-07-19T12:59:18.740Z data_feeds WARNING: Test WARNING message (logging)Logurufromlogutilimportinit_loguru,get_loguru_loggerinit_loguru()logger=get_loguru_logger(slack_on=True,slack_level='WARNING',slack_webhook_url='<your slack app webhook url string>',)logger.info('Test INFO message (loguru)')logger.warning('Test WARNING message (loguru)')2020-07-19T12:56:20.771Z __main__ INFO: Test INFO message (loguru)
2020-07-19T12:56:20.771Z __main__ WARNING: Test WARNING message (loguru)NotesFormatting is ignored forsentrynotifications withlogging
Package: logutilities
logutilitieslogutilities is a python library for quick logging of functionsInstallationUse the package managerpipto install logutilities.pipinstalllogutilitiesUsageimportfoobarfoobar.pluralize('word')# returns 'words'foobar.pluralize('goose')# returns 'geese'foobar.singularize('phenomena')# returns 'phenomenon'ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseMIT
Package: logutils
The logutils package provides a set of handlers for the Python standard
library’s logging package.Some of these handlers are out-of-scope for the standard library, and
so they are packaged here. Others are updated versions which have
appeared in recent Python releases, but are usable with older versions
of Python and so are packaged here.The source code repository is at:https://bitbucket.org/vinay.sajip/logutils/Documentation is available at:https://logutils.readthedocs.io/https://pythonhosted.org/logutils/
Package: logutils-serpucga
Logging utilsEste repositorio contiene un código muy básico que sirve para dar un formato
visual e informacionalmente completo a los logs usando la librería estándar
logging. Por supuesto, esta configuración podría realizarse cada vez en cada
proyecto, pero encuentro eso engorroso y una pérdida de tiempo, así que he
considerado mejor externalizarlo todo a una pequeña librería externa.Utilizaciónfrom logutils import get_logger

logger = get_logger(__name__)
logger.info("Hola hola!")
Package: loguwant
loguwantIt's a Python package that enables you to log only what you want. It creates logger, using which you can see the logs of
the modules written by you separately.For this we have to defined log level of root logger and log Level of the modules you write and whose logs you want to
print as environment variables ROOT_LOG_LEVEL and CURRENT_LOG_LEVEL respectively.We can also switch this functionality by using LOG_DEPTH environment variable.usesexport ROOT_LOG_LEVEL=DEBUG
export CURRENT_LOG_LEVEL=DEBUG
export LOG_DEPTH=currentfromloguwantimportloggerlogger=logger.get_logger()defexample_function():try:print('It is an example function to show working of loguwant package')logger.debug(logger.prepare_log('It is an debug log'))logger.info(logger.prepare_log('It is an info log'))logger.warning(logger.prepare_log('It is an warning log'))exceptExceptionaserr:logger.error(logger.prepare_exception_log('It is an error log'))output
Package: logux
logux-pyThe Python interface to theLoguxserver.Installationlogux-py requires a running Logux server.
See Logux'squickstart.Then install packagefrom PyPi:pipinstallloguxUsage>>>importlogux# todoRead more:documentation.FeaturesNone so far!LicenceThe package is available as open source under the terms of theMIT License.Code of ConductEveryone interacting in the logux-py project’s codebases, issue trackers, chat rooms
and mailing lists is expected to follow theBerlin Code of Conduct.ContributingSeecontributing guide,
thenissues list.History0.0.1 (2018-10-16)First release on PyPI.
Package: logviewer
Logviewer allows you to tail files to the web for sharing with other people.Requirements:Python >= 3.6aiohttpaiohttp_jinja2Install Logviewer:$pip3installlogviewerUsage:$logviewer-f/path/to/file.log--port8080$tail-f/path/to/file.log|logviewerCommand line options are:-pPORT,--portPORTSpecifythewebserverport(defaultto8080)-fFILE,--fileFILEFilepath(defaulttostdin)
Package: log-viewer
log-viewer: log web-exposer toolkitWhat is log-viewer for?log-vieweris just a lightweight Python package that web-exposes your log files usingFlask'sinterface.How do I get set up?Requisitespython>= 3.6 running on a
Linux environment.Where to get itPyPirepository, execute:pipinstalllog-viewerInstallation from sourcesCloning the gitrepo, execute in root folder:pythonsetup.pyinstallUseAfter package installation, execute:log-viewerlog-viewerwill search log files and it will expose them within HTML native accordions inhttp://0.0.0.0:8081(default)No login is needed by default. In order to activate the login, just set user or password
through the execution options.Execution optionslog-viewerexecution options:-a --addressLogs exposing address. Default: "0.0.0.0"-p --portLogs exposing port. Default: 8081-u --userUser for login, it activates the login mode. If no password is set, the
login mode will only check the
provided user-psw --passwordPassword for login, it activates the login mode. If no user is set,
the login mode will only check
the provided password-lp --logPathsPaths to search (recursively) the logs from (";" separated).
Default: "/var/log/"ExampleThe following example will activate the login mode with custom parameters:log-viewer-uadmin-pswadmin-p8080-lp"/var/log/django;/var/log/apt"-a"127.0.0.1"LicenseMITDependenciesFlask>= 1*Contactmoonrollersoft@gmail.com
Package: logwatch
Email alerts when tail -1 of log file does not match regexInstallationFrom the project root directory:$ python setup.py installUsageWatch file at /var/log/nginx/access.log using configured regex in ~/.watcher.yml:$ logwatch /var/log/nginx/access.logWatch file, sleeping for 60 seconds, with verbosity to print regex matches$ logwatch /var/log/nginx/access.log -S 60 -vWatch with special regex and print groups timestamp and message, ignoring empty file$ logwatch /var/log/foo.log -r ‘[(?P<timestamp>d+)] (?P<message>.*)’ -eUse –help/-h to view info on the arguments:$ logwatch --helpRelease Notes0.1.0:Alpha runs and works0.0.1:Project created
Package: logwatcher-kafka-plugin
This Plugin allows LogWatcher (https://github.com/CityGrid/logwatcher) to send log lines to a Kafka Topic. This topic can then be consumed by any other application including applicaitons like LogStash.  This Plugin requires LogWatcher. Copyright 2015 CityGrid Media, LLC Licensed under the Apache License, Version 2.0http://www.apache.org/licenses/LICENSE-2.0#  Copyright 2015 CityGrid Media, LLC
#
#  Licensed under the Apache License, Version 2.0 (the “License”);
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an “AS IS” BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
Changelog
=========Wishlistfeature: TBD.1.0Initial release
Package: log-with-context
log-with-contextis a Python logger that saves variables in a
thread-local context to be passed asextrato Pythonloggingmethods.Note thatlog-with-contextassumes that you are passing context
in a multithreading sense–not in an asyncio sense.InstallationThis library is available on PyPI and can be installed withpython3-mpipinstalllog-with-contextUsageThis library provides a wrapped Python logging.Logger that
adds a shared context to each logging message, passed as
theextraparameter.You will need an additional library(likeJSON-log-formatter)to actually output the logging messages. We avoided putting this
functionality in this library to keep it lightweight and flexible.
We assumed that you already have a preferred way to format your
logging messages.importloggingimportlogging.configfromlog_with_contextimportadd_logging_context,Loggerlogging.config.dictConfig({"version":1,"disable_existing_loggers":True,"formatters":{"json":{"()":"json_log_formatter.JSONFormatter"},},"handlers":{"console":{"formatter":"json","class":"logging.StreamHandler",}},"loggers":{"":{"handlers":["console"],"level":"INFO"},},})LOGGER=Logger(__name__)LOGGER.info("First message. No context")withadd_logging_context(current_request="hi"):LOGGER.info("Level 1")withadd_logging_context(more_info="this"):LOGGER.warning("Level 2")LOGGER.info("Back to level 1")LOGGER.error("No context at all...")The above program logs the following messages to standard error:{"message":"First message. No context","time":"2021-04-08T16:37:23.126099"}{"current_request":"hi","message":"Level 1","time":"2021-04-08T16:37:23.126336"}{"current_request":"hi","more_info":"this","message":"Level 2","time":"2021-04-08T16:37:23.126389"}{"current_request":"hi","message":"Back to level 1","time":"2021-04-08T16:37:23.126457"}{"message":"No context at all...","time":"2021-04-08T16:37:23.126514"}This example may look trivial, but it is very handy to maintain a
logging context up and down a Python call stack without having
to pass additional variables to the functions and methods
that you call.Implementation detailsLogging contexts are stored as thread-local variables. If you want
to share information between threads, you must create a Logging
context in each thread with the same information.Similarly, logging contexts aredeliberately not copiedwhen
creating subprocesses. This is done to minimize bugs and make sure
that log-with-context behaves in the exact same manner across
operating systems.
Package: log-wizard
log_wizardInstallationTo get started with Log Wizard, you can easily install it using pippipinstalllog-wizardusagefromlog_wizardimportDefaultConfig,log# initilize DefaultConfig if need# You can do it onece, before first call of log# Also look at params for DefaultConfig# info_file_postfix takes all log msgs except .debug# debug_file_postfixh takes all log msgsDefaultConfig(info_file_postfix='info',debug_file_postfixh='debug')# I can add a handler for your own function# DefaultConfig().set_ui_log_func(print)# now in any module of your project you can use this loglog=log()# write log infolog.info("info")# 20.09.2023 06:10:35 - INFO - infolog.error("error")# 20.09.2023 06:10:35 - ERROR - errorlog,critical("critical")# 20.09.2023 06:10:35 - CTITICAL - criticalproc_id='12345'withlog.insert_proc_id(proc_id):#20.09.2023 06:10:35 - INFO - 12345 - here should be proc idlog.info("here should be proc id")withlog.insert_func_name():log.info("here also should be proc id and a func name, where log was called")ConfigurationYou can configure Log Wizard by modifying the DefaultConfig class.FeaturesInsert process IDs into log messages
Insert function names into log messages
Supports different log levels (info, error, debug, critical, etc.)LicenseThis project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.ContactFor any questions or feedback, feel free to contact me atruslan.izhakovskij@gmail.com.
Package: logworks
logworks is a convenience wrapper for the logging Python module. It is useful for me and the work I do at IHCantabria.I make it public with best wishes, but no implication is made about its potential utility and usability for others. logworks is distributed as free software, under the GPLv3.Some examplesNOTE: GitHub's markdown parser discards some HTML. As a result, the outputs below lack color.Defaultfromlogworksimportlogworkslogger=logworks.Logger()logger.debug("Verbose debug")logger.info("This is some info")logger.ok("Everything is ok")logger.warning("Danger! Danger!")logger.error("Something went wrong")Yields the following (your exact colors may vary). Note debug text is not logged.2018-04-11 12:10:35[INFO]This is some info
2018-04-11 12:10:35[OK]Everything is ok
2018-04-11 12:10:35[WARNING]Danger! Danger!
2018-04-11 12:10:35[ERROR]Something went wrongDebugimportloggingfromlogworksimportlogworkslogger=logworks.Logger(level=logging.DEBUG)logger.debug("Verbose debug")Yields (now it logs debug). Note that default color for debug is no color.2018-04-11 12:10:35 [DEBUG] Verbose debugNo colorsfromlogworksimportlogworkslogger=logworks.Logger(use_color=False)logger.info("This is some info")logger.ok("Everything is ok")logger.warning("Danger! Danger!")logger.error("Something went wrong")Yields:2018-04-11 12:10:35 [INFO] This is some info
2018-04-11 12:10:35 [OK] Everything is ok
2018-04-11 12:10:35 [WARNING] Danger! Danger!
2018-04-11 12:10:35 [ERROR] Something went wrongCustom formatterimportloggingfromlogworksimportlogworksmyformatter=logging.Formatter(fmt='{clevelname}-{asctime}-{message}',datefmt="%H:%M:%S",style="{")logger=logworks.Logger(console_formatter=myformatter)logger.info("This is some custom info")Yields:[INFO]- 12:10:35 - This is some custom info
Package: logwrapper
READMETable of ContentsConfigurationUsagePython log wrapperConfigurationConfiguration file example (toml format)[log]to_console=trueconsole_level='DEBUG'to_file=truefile_level=['INFO','WARNING','ERROR','CRITICAL']format='%(asctime)s | %(levelname)-8s | <%(threadName)s> %(module)s.%(funcName)s [%(lineno)d]: %(message)s'to_console: whether to output log to STDOUT, 'true' or 'false', use it during debugging, and close it during formal deploymentconsole_level: console log level (string), optional values are 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'to_file: whether to output log to file, 'true' or 'false'file_level: file log level (list), fill in 'INFO', 'WARNING', 'ERROR', 'CRITICAL' according to the actual situationformat: log format, '8' represents the string length, '-' represents left alignment (default right alignment)Usagefromlogwrapperimportget_loggerlog_conf={'to_console':True,'console_level':'DEBUG','to_file':True,'file_level':['WARNING','ERROR','CRITICAL'],'format':'''%(asctime)s | %(levelname)-8s | <%(threadName)s> ''''''%(module)s.%(funcName)s [%(lineno)d]: %(message)s'''}defmain():"""docstring for main"""logger=get_logger(logfolder='logs',config=log_conf)logger.warning('Warning text')logger.error('Error text')logger.critical('Critical text')if__name__=="__main__":main()
Package: logx
logx: best practice python logging with zero configConfiguring logging is tedious. Reading the logging module docs makes me tired.Wouldn't it be nice to log as easily as doing a print statement, without any upfront config?Obligatory exampleEnterlogx. It's as simple as:>>> from logx import log
>>> log.info('hello world')
hello world
>>> log.set_default_format()
>>> log.warn('warning!')
[2018-02-26 21:51:16,971] WARNING [__main__.<module>:1] warning!Logs get logged automatically to the logger whose name matches the current module.List of sweet featuresCreates loggers lazily/as needed/on demand andlogs to the appropriate logger automatically. If you're in the "acme" module it'll log to a log called "acme", no need worry about logger names and instances.Shows all log messages by default, which follows the principle of least surprise and is probably what you want when debugging.Included default handlerlogs to the appropriate standard output stream by default: Errors and warnings to stderr, the rest to stdout.Allows easy following of best practice when including log statements in a library:Just call log.create_null_handler() in your module.Uses the standard logging library, so you can still customize your setup as much as you want/need. Plays nicely with your existing logging config files.Includes the very useful logging_tree modulefor viewing your current logging configuration.logx.print_diagram()Install>>> pip install logxContributeIssues and pull requests welcome, hit me. Am I doing logging completely wrong? Critique welcome, even if very pedantic.
Package: logxstract
Library for extracting xml from logs. Finds xml matching criteria and
saves results to file.Install$pipinstalllogxstractUsage as libraryfromlogxstractimportextract_xml_from_fileextract_xml_from_file(path='/item',body='/item',input_file='sample.log',output_file='result.txt')#extracted xml is now in result.txt fileUsage in shell$logxtract-p/item-b/item-fsample.log-oresult.txtHistory0.0.1 (2017-11-04)First release on PyPI.
Package: logy
What is Logy?Logy is a central logging system for Python based on Flask.  It can receive
logging records from other servers through Internet and store them in database,
then display it as web pages.InstallationTo install Logy:pip install logyHow to use it?Before you can write some records to Logy, you need to initialize the database.
Type and runlogy_initdbBy default, it creates sqlite3 database in current directory. And to run the
server, here typelogy_runAnd you should see following line in console* Running on http://127.0.0.1:5000/And here you can open the browser to see the index page. But there is no
record in database by now. To write some records to the database, you need to
install logging handler first. To install it, typepip install ex_loghandlersWith the extended logging handler, here is a simple python module which
writes logging records to Logy.import logging

import ex_loghandlers

rootLogger = logging.getLogger('')
rootLogger.setLevel(logging.DEBUG)

sream_handler = logging.StreamHandler()
# set up the http handler which writes records to Logy server
http_handler = ex_loghandlers.ExHTTPHandler(host='localhost:5000',
                                            url='/sink/TEST/myapp',
                                            method='POST')
rootLogger.addHandler(sream_handler)
rootLogger.addHandler(http_handler)

logger1 = logging.getLogger('myapp.area1')
logger2 = logging.getLogger('myapp.area2')

logger1.debug('Quick zephyrs blow, vexing daft Jim.')
logger1.info('How quickly daft jumping zebras vex.')
logger2.warning('Jail zesty vixen who grabbed pay from quack.')
logger2.error('The five boxing wizards jump quickly.')

try:
    raise Exception("Boom")
except:
    logger1.fatal("Huston, we've got a problem", exc_info=True)

logger1.info('Everything goes fine, now.')And here you can open the urlhttp://127.0.0.1:5000/and see those logging
records. Here is some details of the parameters for the logging server in
the url “/sink/TEST/myapp”TEST - it is the API key for logging servicemyapp - it is what name of application you’re running nowFor example, you have a server which is running three different application
proxy01, web01 and mail01, then you can write url like this:/sink/TEST/proxy01
/sink/TEST/web01
/sink/TEST/mail01ConfigurationOf course, you won’t run logy directly in production environment, you need to
write your own configuration.  You can see the default configuration in
logy/default_settings.py, you don’t have to modify the configuration file
directly, instead, you can copy it and modify it.To run the server with your own configuration, you can set up an environment
variable, for example:LOGY_SETTINGS=myconfig.py logy_runAnd here you are, the server is running with your own configuration.