Coder Social home page Coder Social logo

Comments (5)

hanneskod avatar hanneskod commented on July 18, 2024

Here is a quick fix:

*** Monolog/Logger.php  2012-03-13 13:27:21.343220815 +0100
--- local/Logger.php    2012-03-13 12:29:59.531228485 +0100
***************
*** 162,174 ****
          if (!$this->handlers) {
              $this->pushHandler(new StreamHandler('php://stderr', self::DEBUG));
          }
          $record = array(
              'message' => (string) $message,
              'context' => $context,
              'level' => $level,
              'level_name' => self::getLevelName($level),
              'channel' => $this->name,
!             'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6f', microtime(true))),
              'extra' => array(),
          );
          // check if any message will handle this message
--- 162,179 ----
          if (!$this->handlers) {
              $this->pushHandler(new StreamHandler('php://stderr', self::DEBUG));
          }
+         
+         // Replace , with . in time to support locales using , as decimal digit separator
+         $time = sprintf('%.6f', microtime(true));
+         $time = str_replace(',', '.', $time);
+         
          $record = array(
              'message' => (string) $message,
              'context' => $context,
              'level' => $level,
              'level_name' => self::getLevelName($level),
              'channel' => $this->name,
!             'datetime' => \DateTime::createFromFormat('U.u', $time),
              'extra' => array(),
          );
          // check if any message will handle this message

from monolog.

Seldaek avatar Seldaek commented on July 18, 2024

Thanks for reporting and for the proposed fix, I'll take a look later this week hopefully, crazy busy right now no time to look in detail.

from monolog.

Seldaek avatar Seldaek commented on July 18, 2024

I wasn't able to reproduce unfortunately, but I think the fix I pushed is correct nonetheless. Please check and confirm.

from monolog.

hanneskod avatar hanneskod commented on July 18, 2024

Fix is confirmed. I guess the locale in question have to be installed in your OS to reproduce this behavoir...

A really nice fix I must say though. For someone like myself, not comming from the world of C, the sprintf function often seams like magic. This time all that was needed was a 10 sec. look at the documentation. So it goes!

from monolog.

Seldaek avatar Seldaek commented on July 18, 2024

Ok cool!

from monolog.

Related Issues (20)

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.