strigo / wryte Goto Github PK
View Code? Open in Web Editor NEWA Python logger for people who want some logging sanity
License: Apache License 2.0
A Python logger for people who want some logging sanity
License: Apache License 2.0
The current default format is timestamp - name - level - message
. We should allow to simply log message
by providing a flag when instantiating the logger.
For example, log.info({})
will fail as the first field is expected to be a string.
An event implies that "Something applicative happened now". e.g. user logged in or credit card transaction made.
It would be useful to add a type
field which will default to type=log
. When sending an event via wryte.event
, it can append a type=event
kv instead. This will allow users to search only on events instead of their context (the logs).
To increase performance, maybe a conversion table for severity levels can be avoided and the user should take the hit if providing a wrongly named level (uppercase, lowercase, etc..)
Just like EC2
Instead of having to provide a plethora of fields every time something happens, it would make sense to allow to create child loggers consisting of permanent fields:
wryte = Wryte()
new_wryte = wryte.child({'key1': 'value1'})
new_wryte.info(...)
...
new_wryte
will include the key1
field for every log message it generates.
Since kv pair string support in the context was removed in the API, it now isn't supported in the CLI either. We should add that back for the CLI only.
Much like Grafana's env-var based configuration, it would be nice to support configuring wryte via environment variables.
For instance:
WRYTE_LOGGER_NAME_aggr_elasticsearch_endpoint
would configure the logger named LOGGER_NAME
to emit JSON formatted logs to the endpoint provided.
Like so:
WRYTE_LOGGER_NAME_console_enabled
WRYTE_LOGGER_NAME_console_level
WRYTE_LOGGER_NAME_aggr_elasticsearch_endpoint
# implicit enablement
WRYTE_LOGGER_NAME_aggr_elasticsearch_level
WRYTE_LOGGER_NAME_aggr_logzio_enabled
# implicit enablement
WRYTE_LOGGER_NAME_aggr_logzio_level
WRYTE_LOGGER_NAME_aggr_logzio_token
...
Instantiating the handler with coloring options could automatically color warning yellow, error in red and critical in maroon or something.
By enabling via a flag or an env var, we should support adding things like the instance-id, instance-type, region and local ipv4 to each log message.
on:
It would be nice to support automated delivery of exceptions, nicely formatted, when an exception object is passed to the logger.
Something like wryter.info('my_message', _nl=False)
would make sense.
We can use the logger.findCaller()
method to retrieve stack information.
This should be configurable via WRYTE_INCLUDE_SRC
and a method flag and should be documented that it shouldn't be used in production as it degrades performance greatly.
e.g. wryter.info('my_message', _fg='green', _bg='white')
Let's say that you just received a login event (e.g. wryte.info('User Logged In)
).
You would now like to follow up that that event throughout its logs (db connections, etc..).
It would be good to allow to bind an auto-generated context_id
which will follow the event until it finishes and then lose the id.
https://github.com/cmanaha/python-elasticsearch-logger/blob/master/cmreslogging/handlers.py#L61
Currently only basic config options are allowed.
To support:
logger.info('message', x=y)
When using the simple
flag, Wryte should output kv pairs like so:
2018-04-10T21:58:53.682506 - Wryte - INFO - w00t - key1=value1 key2=value2
Pros:
Single line log messages
Cons:
May overflow a single line and then be half readable
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.