mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
FEATURE: add shouldShowTime
Relates to [this forum request](https://forums.meteor.com/t/suggestions-for-logging-in-galaxy/63119/6?u=grubba). Those that use `colored-text` output format can now decide if they want the timestamp or can rely on their server/cloud environments info.
This commit is contained in:
@@ -44,6 +44,11 @@ Log._intercepted = () => {
|
||||
// other process that will be reading its standard output.
|
||||
Log.outputFormat = 'json';
|
||||
|
||||
// Defaults to true for local development and for backwards compatibility.
|
||||
// for cloud environments is interesting to leave it false as most of them have the timestamp in the console.
|
||||
// Only works in server with colored-text
|
||||
Log.shouldShowTime = true;
|
||||
|
||||
const LEVEL_COLORS = {
|
||||
debug: 'green',
|
||||
// leave info as the default color
|
||||
@@ -296,13 +301,15 @@ Log.format = (obj, options = {}) => {
|
||||
|
||||
const stderrIndicator = stderr ? '(STDERR) ' : '';
|
||||
|
||||
const timeString = Log.shouldShowTime
|
||||
? `${dateStamp}-${timeStamp}${utcOffsetStr}${timeInexact ? '? ' : ' '}`
|
||||
: ' ';
|
||||
|
||||
|
||||
|
||||
const metaPrefix = [
|
||||
level.charAt(0).toUpperCase(),
|
||||
dateStamp,
|
||||
'-',
|
||||
timeStamp,
|
||||
utcOffsetStr,
|
||||
timeInexact ? '? ' : ' ',
|
||||
timeString,
|
||||
appInfo,
|
||||
sourceInfo,
|
||||
stderrIndicator].join('');
|
||||
|
||||
Reference in New Issue
Block a user