~jameinel/loggo/benchmarks

« back to all changes in this revision

Viewing changes to logger.go

  • Committer: John Arbash Meinel
  • Date: 2013-06-02 10:40:23 UTC
  • Revision ID: john@arbash-meinel.com-20130602104023-y1k36pqoop6j8frc
Cache the global minimum log level necessary to get out to a writer.

With this change, we drop from 1200ns for no-op writes all the way down to
25ns. However, this might be better done at the logging side, rather than at the
writer side.

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
func (logger Logger) Log(level Level, message string, args ...interface{}) {
234
234
        if logger.getModule().getEffectiveLogLevel() > level ||
235
235
                level < TRACE ||
236
 
                level > CRITICAL {
 
236
                level > CRITICAL ||
 
237
                !WillWrite(level) {
237
238
                return
238
239
        }
239
 
        // Gather time, and filename, line number.
 
240
        // Gather time, and filename, line number.O
240
241
        now := time.Now() // get this early.
241
242
        var file string
242
243
        var line int