This language bar is your friend. Select your favorite languages!
Select your favorite languages :
- Or search :
Console.WriteLine($"[{DateTime.Now}] {msg}");
Default behavior of Console.WriteLine is stdout. DateTime should respect system culture defaults.
log(msg);
the standard library package logger prints messages with their date and their call site.
print('${DateTime.now()} msg');
it will output to standard console. The date format will be human readable.
@Slf4j
class X {
def m(String message) {
log.debug(message)
}
}
Logger LOGGER = Logger.getLogger(MyClass.class.getName());
LOGGER.info(msg);
LOGGER should be declared private and final, at the beginning of the class.
out.printf("%tc: `%s`%n", currentTimeMillis(), msg);
my $logline = sprintf "%s %s\n", localtime->strftime('%F %T'), $msg;
print $logline; # stdout
warn $logline; # stderr
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format="%(asctime)-15s %(message)s")
logger = logging.getLogger('NAME OF LOGGER')
logger.info(msg)
Default output is stderr.
Date format is ISO 8601.
Date format is ISO 8601.
logger = Logger.new('logfile.log') # or STDOUT or STDERR
logger.info(msg)
Default Log format:
SeverityID, [DateTime #pid] SeverityLabel -- ProgName: message
The default can be customized, as well as the datetime format.
SeverityID, [DateTime #pid] SeverityLabel -- ProgName: message
The default can be customized, as well as the datetime format.
programming-idioms.org