wireapp/webapp-module-logger

Name: webapp-module-logger

Owner: Wire Swiss GmbH

Description: null

Created: 2016-07-12 08:04:37.0

Updated: 2017-10-19 12:27:07.0

Pushed: 2017-10-29 16:21:38.0

Homepage: null

Size: 58

Language: CoffeeScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Wire

This repository is part of the source code of Wire. You can find more information at wire.com or by contacting opensource@wire.com.

You can find the published source code at github.com/wireapp/wire.

For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.

Description

A powerful logger for Texts and objects (not for functions!).

Instructions
install
t

eate release version
t dist
Log level order
 -> 0
L_1: -> 300 # FINEST (lowest value)
L_2: -> 400 # FINER
L_3: -> 500 # FINE
G: -> 700   # CONFIG
: -> 800    # INFO
: -> 900    # WARNING
R: -> 1000  # SEVERE
Recommended usage of log levels
Usage
s Demo.DemoClass
nstructor: () ->
@logger = new z.util.Logger 'Test', options
@logger.level = @logger.levels.LEVEL_1

object =
  first_line: "Hello"
  second_line: "World"

ogger.log 'Log text.'
ogger.log 'Log text with object.', object
ogger.log 'Log text with priority.', @logger.levels.WARN
@logger.log 'Log text with priority and objects.', @logger.levels.WARN, object, object
@logger.log 'Log in whatever order you want.', object, @logger.levels.INFO, object, object

Use aliases for different log levels
ogger.info 'Log text as info.'
ogger.debug 'Log text as debug.'
ogger.error 'Log text as error.'
ogger.warn 'Log text as warning.'

Only log steps which have a minimum log level of info
ogger.level = @logger.levels.INFO
ogger.log 'This will not be shown.'
ogger.log 'This will...!', @logger.levels.INFO
ogger.log 'And this too!', @logger.levels.WARN
ogger.log @logger.levels.WARN', Even this!'

Don't show any log messages
ogger.level = @logger.levels.OFF
Another example
ger = new z.util.Logger 'z.auth.AuthRepository', name_length: 54
ger.set_domains
ocalhost': @logger.levels.LEVEL_1
ppspot.com': @logger.levels.LEVEL_1
ire.com': @logger.levels.INFO

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.