Crystal: Constant warning message when using crystal

Created on 8 May 2020  路  4Comments  路  Source: crystal-lang/crystal

I have installed crystal this week on Ubuntu with version 0.34. Unfortunately, whenever I run, test or build a program ( I have tried several different ones), I get the following warning:

In /usr/share/crystal/src/logger.cr:140:3

 140 | {% for name in Severity.constants %}
       ^
Warning: expanding macro


There was a problem expanding macro 'macro_139646382676384'

Called macro defined in /usr/share/crystal/src/logger.cr:140:3

 140 | {% for name in Severity.constants %}

Which expanded to:

     1 | 
     2 |     DEBUG = Severity::DEBUG
     3 | 
     4 |     # Returns `true` if the logger's current severity is lower or equal to `DEBUG`.
     5 |     def debug?
     6 |       level <= Severity::DEBUG
     7 |     end
     8 | 
     9 |     # Logs *message* if the logger's current severity is lower or equal to `DEBUG`.
    10 |     # *progname* overrides a default progname set in this logger.
    11 |     def debug(message, progname = nil)
    12 |       log(Severity::DEBUG, message, progname)
    13 |     end
    14 | 
    15 |     # Logs the message as returned from the given block if the logger's current severity
    16 |     # is lower or equal to `DEBUG`. The block is not run if the severity is higher.
    17 |     # *progname* overrides a default progname set in this logger.
    18 |     def debug(progname = nil)
    19 |       log(Severity::DEBUG, progname) { yield }
    20 |     end
    21 |   
    22 |     INFO = Severity::INFO
    23 | 
    24 |     # Returns `true` if the logger's current severity is lower or equal to `INFO`.
    25 |     def info?
    26 |       level <= Severity::INFO
    27 |     end
    28 | 
    29 |     # Logs *message* if the logger's current severity is lower or equal to `INFO`.
    30 |     # *progname* overrides a default progname set in this logger.
    31 |     def info(message, progname = nil)
    32 |       log(Severity::INFO, message, progname)
    33 |     end
    34 | 
    35 |     # Logs the message as returned from the given block if the logger's current severity
    36 |     # is lower or equal to `INFO`. The block is not run if the severity is higher.
    37 |     # *progname* overrides a default progname set in this logger.
    38 |     def info(progname = nil)
    39 |       log(Severity::INFO, progname) { yield }
    40 |     end
    41 |   
    42 |     WARN = Severity::WARN
    43 | 
    44 |     # Returns `true` if the logger's current severity is lower or equal to `WARN`.
    45 |     def warn?
    46 |       level <= Severity::WARN
    47 |     end
    48 | 
    49 |     # Logs *message* if the logger's current severity is lower or equal to `WARN`.
    50 |     # *progname* overrides a default progname set in this logger.
    51 |     def warn(message, progname = nil)
    52 |       log(Severity::WARN, message, progname)
    53 |     end
    54 | 
    55 |     # Logs the message as returned from the given block if the logger's current severity
    56 |     # is lower or equal to `WARN`. The block is not run if the severity is higher.
    57 |     # *progname* overrides a default progname set in this logger.
    58 |     def warn(progname = nil)
    59 |       log(Severity::WARN, progname) { yield }
    60 |     end
    61 |   
    62 |     ERROR = Severity::ERROR
    63 | 
    64 |     # Returns `true` if the logger's current severity is lower or equal to `ERROR`.
    65 |     def error?
    66 |       level <= Severity::ERROR
    67 |     end
    68 | 
    69 |     # Logs *message* if the logger's current severity is lower or equal to `ERROR`.
    70 |     # *progname* overrides a default progname set in this logger.
    71 |     def error(message, progname = nil)
 >  72 |       log(Severity::ERROR, message, progname)
    73 |     end
    74 | 
    75 |     # Logs the message as returned from the given block if the logger's current severity
    76 |     # is lower or equal to `ERROR`. The block is not run if the severity is higher.
    77 |     # *progname* overrides a default progname set in this logger.
    78 |     def error(progname = nil)
    79 |       log(Severity::ERROR, progname) { yield }
    80 |     end
    81 |   
    82 |     FATAL = Severity::FATAL
    83 | 
    84 |     # Returns `true` if the logger's current severity is lower or equal to `FATAL`.
    85 |     def fatal?
    86 |       level <= Severity::FATAL
    87 |     end
    88 | 
    89 |     # Logs *message* if the logger's current severity is lower or equal to `FATAL`.
    90 |     # *progname* overrides a default progname set in this logger.
    91 |     def fatal(message, progname = nil)
    92 |       log(Severity::FATAL, message, progname)
    93 |     end
    94 | 
    95 |     # Logs the message as returned from the given block if the logger's current severity
    96 |     # is lower or equal to `FATAL`. The block is not run if the severity is higher.
    97 |     # *progname* overrides a default progname set in this logger.
    98 |     def fatal(progname = nil)
    99 |       log(Severity::FATAL, progname) { yield }
   100 |     end
   101 |   
   102 |     UNKNOWN = Severity::UNKNOWN
   103 | 
   104 |     # Returns `true` if the logger's current severity is lower or equal to `UNKNOWN`.
   105 |     def unknown?
   106 |       level <= Severity::UNKNOWN
   107 |     end
   108 | 
   109 |     # Logs *message* if the logger's current severity is lower or equal to `UNKNOWN`.
   110 |     # *progname* overrides a default progname set in this logger.
   111 |     def unknown(message, progname = nil)
   112 |       log(Severity::UNKNOWN, message, progname)
   113 |     end
   114 | 
   115 |     # Logs the message as returned from the given block if the logger's current severity
   116 |     # is lower or equal to `UNKNOWN`. The block is not run if the severity is higher.
   117 |     # *progname* overrides a default progname set in this logger.
   118 |     def unknown(progname = nil)
   119 |       log(Severity::UNKNOWN, progname) { yield }
   120 |     end
   121 |   
Warning: Deprecated Logger+#log. Use `Log` module instead

Do you know what this is?
Thanks

Most helpful comment

@Uzay-G So essentially you can probably just ignore that.

Unfortunately these warning messages are way too noisy. There should just be a single line telling about it, not three pages of code trace screeming at you.

All 4 comments

Are you using the Logger module? Or at least some shard that you have installed?

It's essentially telling you that Logger is deprecated in favor of Log. So either you, or a shard you're using needs to update their code to use the new module.

@Uzay-G So essentially you can probably just ignore that.

Unfortunately these warning messages are way too noisy. There should just be a single line telling about it, not three pages of code trace screeming at you.

Unfortunately these warning messages are _way_ too noisy

I really want this fixed before too long. Warnings should be limited to 1, maybe 3 at most, lines per warning.

I tried to implement this before but got lost inside compiler refactors...

Refs #8963

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RX14 picture RX14  路  3Comments

Sija picture Sija  路  3Comments

will picture will  路  3Comments

Papierkorb picture Papierkorb  路  3Comments

jhass picture jhass  路  3Comments