Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request : username, PID (analog to programname) #76

Closed
bitranox opened this issue Sep 18, 2019 · 3 comments
Closed

Feature Request : username, PID (analog to programname) #76

bitranox opened this issue Sep 18, 2019 · 3 comments

Comments

@bitranox
Copy link

it would be super if You can implement
username (analog to programname) and include it into the fieldstyles.

what You think ?

yours sincerely

Robert

@xolox
Copy link
Owner

xolox commented Feb 15, 2020

Hi Robert and thanks for the suggestion. I've just released coloredlogs 11.3 which adds support for the %(username)s field. Just add the new field to your custom format string and everything should magically work 😇 (once you've upgraded to the new version).

@xolox xolox closed this as completed Feb 15, 2020
bors bot added a commit to duckinator/bork that referenced this issue Feb 16, 2020
112: Update coloredlogs to 12.0 r=duckinator a=pyup-bot


This PR updates [coloredlogs](https://pypi.org/project/coloredlogs) from **11.0** to **12.0**.



<details>
  <summary>Changelog</summary>
  
  
   ### 12.0
   ```
   ----------------------------

Two backwards incompatible changes prompted another major version bump:

- Merged pull request `80`_ that drops support for Python 3.4 which
  has gone end-of-life and now represents less than 1% of PyPI downloads.

- Improved compatibility with the Python standard library by changing
  the order of positional arguments received by the initializer of the
  :class:`~coloredlogs.ColoredFormatter` class (as suggested in `64`_
  and `75`_).

.. _Release 12.0: xolox/python-coloredlogs@11.3...12.0
.. _80: xolox/python-coloredlogs#80
.. _64: xolox/python-coloredlogs#64
.. _75: xolox/python-coloredlogs#75
   ```
   
  
  
   ### 11.3
   ```
   ----------------------------

- Add support for the ``%(username)s`` field (requested in `76`_) and properly
  document supported custom fields.

- Consistently use ``console`` highlighting in documentation.

- Fix a broken link in the readme.

.. _Release 11.3: xolox/python-coloredlogs@11.2...11.3
.. _76: xolox/python-coloredlogs#76
   ```
   
  
  
   ### 11.2
   ```
   ----------------------------

Merge pull request `79`_ which adds support for Python 3.8.

.. _Release 11.2: xolox/python-coloredlogs@11.1...11.2
.. _79: xolox/python-coloredlogs#79
   ```
   
  
  
   ### 11.1
   ```
   ----------------------------

Starting with the previous release I&#39;ve resolved to try and tackle the large
number of open issues after an unplanned hiatus from the development and
maintenance of my open source projects, so here are some more bug fixes:

- Fix support for custom log record factories and add a test to avoid
  regressions (`47`_, `59`_).

- Change ``make screenshots`` to be Python 3 compatible and document
  additional requirements (`65`_).

.. _Release 11.1: xolox/python-coloredlogs@11.0...11.1
.. _59: xolox/python-coloredlogs#59
.. _65: xolox/python-coloredlogs#65
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/coloredlogs
  - Changelog: https://pyup.io/changelogs/coloredlogs/
  - Docs: https://coloredlogs.readthedocs.io
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
@bitranox
Copy link
Author

bitranox commented Feb 16, 2020

Dear Peter,
thank You very much, thats useful.
But can You please also add %(pid)s analog to username, programname ?
The reason is, if You run more then one instance of Your program (or forks of subprograms) You can not be clear which child/instance is logging to the logfile. (If You have a logging system that can handle logging from more then one process)
You might see the PID it in the linux syslog (if it is used), but not in the logfile.
At the moment I do this programmatically, by formatting the format string when adding my (special) stream handler, but it can make sense to support also the %(pid)s keyword.

and I totally agree to dump python 3.4 ;-)

yours sincerely,
and thanks for the new release !

Robert

@bitranox bitranox changed the title Feature Request : username (analog to programname) Feature Request : username, PID (analog to programname) Feb 16, 2020
@bitranox
Copy link
Author

Uh, oh, forget it - of course there is %(process)d

but can there be %(hostname_short)s because in my logs it always logs the fqdn like :

[root@lxc-pydev.local.rotek.at][INFO] some logging event

and I would like to have like

[root@lxc-pydev][INFO] some logging event

yours sincerely
Robert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants