Giter Site home page Giter Site logo

reactphp-psr-3-stdio's Introduction

Standard Out PSR-3 logger for ReactPHP

Linux Build Status Latest Stable Version Total Downloads Code Coverage License PHP 7 ready

Installation

To install via Composer, use the command below, it will automatically detect the latest version and bind it with ^.

composer require wyrihaximus/react-psr-3-stdio 

Usage

$loop = Factory::create(); // ReactPHP event loop
$logger = StdioLogger::create($loop);
$logger->info('log'); // Writes info log to STDOUT

When desired you can hide the log level from output by creating a logger that doesn't write it:

$logger = StdioLogger::create($loop)->withHideLevel(true);

Another option is to write a new line (PHP_EOL) after each line, it is off by default but can be enabled with:

$logger = StdioLogger::create($loop)->withNewLine(true);

Contributing

Please see CONTRIBUTING for details.

License

Copyright 2017 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

reactphp-psr-3-stdio's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar wyrihaximus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

reactphp-psr-3-stdio's Issues

Update to PHP8+

Currently this library is not compatible with the new PHP8+.
Is there any intention to make this compatible with the new versions ?

Messages are concatenated without linebreaks

As this has never come up yet, i first wanted to ask: isn't there a linebreak missing after each message? When i use this logger it concatenates all messages on the same line.

Is that correct or am i using this library wrong?

Channel name/Timestamp support

Hi @WyriHaximus ๐Ÿ‘‹ -- thanks for open sourcing this project!

Would you consider adding the notion of channel names (a la Monolog), effectively acting as a prefix to the log entry's level?

It doesn't have to be disruptive, it can be implemented as a withChannelName() method, in the same spirit as withNewLine() for example.

Happy to propose a pull request if you think it's a good idea.

Update: a withTimestamp() method would be helpful too. It could take a timezone parameter (default to UTC) and perhaps a format parameter (default to ISO 8601 format), although these days modern applications make those timezone and formatting assumptions anyway ๐Ÿ˜‰

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.