Git Product home page Git Product logo

Comments (5)

chk- avatar chk- commented on May 6, 2024 8

I just came across the same issue.
@dougwilson wrote in issue #21 -> #13 "...all logs are in UTC because it is an absolute standard."
I don't think so and found Wikipedia - Common_Log_Format and others.
However, a workaround was also posted at #13 (new Date().toString()) But the output is not the clfdate format!
In principle there is the possibility to use a custom token for that. I show my personal solution:

morgan.token('date', function() {
    var p = new Date().toString().replace(/[A-Z]{3}\+/,'+').split(/ /);
    return( p[2]+'/'+p[1]+'/'+p[3]+':'+p[4]+' '+p[5] );
});

from morgan.

dougwilson avatar dougwilson commented on May 6, 2024

Yes, defining a custom token is the way to change it (which is why you can define tokens).

from morgan.

smilence86 avatar smilence86 commented on May 6, 2024

Okay, thanks~ I have resolved.

from morgan.

zhanbei avatar zhanbei commented on May 6, 2024

Is the :date[clf] supposed to use server timezone like the -0700 in [10/Oct/2000:13:55:36 -0700] from Wikipedia - Common_Log_Format?

It seems to be yes, which I do think should be stated in the README.md file to make it clear.

What do you think? Thanks.

from morgan.

dougwilson avatar dougwilson commented on May 6, 2024

All the dates from the :date token are in UTC, as stated in the README:

The current date and time in UTC. The available formats are:

The formats just present the date and time differently, but they are all in the UTC time zone as documented.

from morgan.

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.