Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
integer :: value(8)
msg = "asdf"
call date_and_time (values=value)
write (unit=*,fmt='(I4,"-",I2.2,"-",I2.2," ",I2.2,":",I2.2,".",I4.4,": ",A)') value(1:3), value(5:7), msg
This writes to standard output,a nd the date format is ISO 8601.
console.log(Date(), msg);
In Node.js environment, console.log() prints to stdout.
console.error(Date(), msg);
In Node.js environment, console.error() prints to stderr.
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.
My.Application.Log.WriteEntry(msg,TraceEventType.Verbose)