All Projects → shellscape → Loglevelnext

shellscape / Loglevelnext

Licence: mpl-2.0
A modern logging library for Node.js that provides log level mapping to the console

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Loglevelnext

Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+315.15%)
Mutual labels:  console, logging, log, logger
Signale
Highly configurable logging utility
Stars: ✭ 8,575 (+25884.85%)
Mutual labels:  console, log, logger
Electron Log
Just a simple logging module for your Electron application
Stars: ✭ 765 (+2218.18%)
Mutual labels:  console, logging, log
webpack-log
A logger for the Webpack ecosystem
Stars: ✭ 18 (-45.45%)
Mutual labels:  console, log, logger
Logging Helpers
Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.
Stars: ✭ 5 (-84.85%)
Mutual labels:  console, logging, log
Monolog Bundle
Symfony Monolog Bundle
Stars: ✭ 2,532 (+7572.73%)
Mutual labels:  logging, log, logger
Go Logger
一个简单而强大的 golang 日志工具包,支持同步和异步输出到 命令行,文件, api 接口,文件支持按文件大小,文件行数,日期切分;A simple and powerful golang logging toolkit that supports synchronous and asynchronous output to the console, file, API interfaces, file support by file size, file line number, date sharding.
Stars: ✭ 152 (+360.61%)
Mutual labels:  console, log, logger
Easylogger
An ultra-lightweight(ROM<1.6K, RAM<0.3k), high-performance C/C++ log library. | 一款超轻量级(ROM<1.6K, RAM<0.3k)、高性能的 C/C++ 日志库
Stars: ✭ 1,968 (+5863.64%)
Mutual labels:  logging, log, logger
logt
🖥️ A colourful logger for the browser
Stars: ✭ 35 (+6.06%)
Mutual labels:  console, log, logger
debug.js
Debugger of JavaScript, by JavaScript, for JavaScript
Stars: ✭ 19 (-42.42%)
Mutual labels:  console, log, logger
gxlog
A concise, functional, flexible and extensible logger for go.
Stars: ✭ 65 (+96.97%)
Mutual labels:  log, logger, logging
Logcat
Android 日志打印框架,在手机上可以直接看到 Logcat 日志啦
Stars: ✭ 189 (+472.73%)
Mutual labels:  logging, log, logger
Acho
The Hackable Log
Stars: ✭ 189 (+472.73%)
Mutual labels:  logging, log, logger
Golog
A high-performant Logging Foundation for Go Applications. X3 faster than the rest leveled loggers.
Stars: ✭ 208 (+530.3%)
Mutual labels:  logging, log, logger
Heliumlogger
A lightweight logging framework for Swift
Stars: ✭ 169 (+412.12%)
Mutual labels:  logging, log, logger
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+11321.21%)
Mutual labels:  logging, log, logger
Node Lambda Log
Basic logging mechanism for Node 6.10+ Lambda Functions
Stars: ✭ 115 (+248.48%)
Mutual labels:  logging, log, logger
Serverlog
A simple, practical and innovative Node.js log library that enables you to view logs in Chrome dev tools and browser Console.
Stars: ✭ 117 (+254.55%)
Mutual labels:  logging, log, logger
ptkdev-logger
🦒 Beautiful Logger for Node.js: the best alternative to the console.log statement
Stars: ✭ 117 (+254.55%)
Mutual labels:  console, log, logger
Console
OS X console application.
Stars: ✭ 298 (+803.03%)
Mutual labels:  console, logging, log
 

tests cover size

loglevelnext

loglevelnext is a modern logging library for Node.js and modern browsers, written with modern patterns and practices which provides log level mapping of the console object.

For browser use, or use in client-side applications, loglevelnext should be bundled by your preferred bundler or compiler, such as Rollup.

Getting Started

First thing's first, install the module:

npm install loglevelnext --save

Usage

Users can choose to use loglevelnext in Node.js or in the client (browser).

const log = require('loglevelnext');

log.info('bananas!');

Log Levels

By default loglevelnext ships supporting the following log level name-value pairs:

{
  TRACE: 0,
  DEBUG: 1,
  INFO: 2,
  WARN: 3,
  ERROR: 4,
  SILENT: 5
}

Default Logger

When requiring loglevelnext in Node.js the default export will be an instance of LogLevel wrapped with some extra sugar.

Methods

Please see LogLevel for documentation of all methods and properties of every log instance, including the default instance.

trace, debug, info, warn, error

These methods correspond to the available log levels and accept parameters identical to their console counterparts. e.g.

console.info('...');
console.info('...');
// ... etc

create(options)

Returns a new LogLevel instance. The options parameter should be an Object matching the options for the LogLevel constructor.

Note: LogLevel instances created are cached. Calling create with a previously used name will return the cached LogLevel instance. To create a different instance with the same name, assign a unique id property to the options parameter.

Properties

factories

Type: Array [ Class ]

Returns an Array containing the factory classes available within loglevelnext to outside modules. Particularly useful when creating plugins. eg.

const log = require('loglevelnext');
const { MethodFactory } = log.factories;
class MyFactory extends MethodFactory { ... }

loggers

Type: Array [ LogLevel ]

Returns an Array containing references to the currently instantiated loggers.

Factories aka Plugins

If you're used to using plugins with loglevel, fear not. The same capabilities are available in loglevelnext, but in a much more straightforward and structured way. loglevelnext supports by way of "Factories." A Factory is nothing more than a class which defines several base methods that operate on the console and provide functionality to a LogLevel instance. All factories must inherit from the MethodFactory class, and may override any defined class functions.

For an example factory, please have a look at the PrefixFactory which provides similar functionality as the loglevel-prefix plugin, and is the factory which is used when a user passes the prefix option to a LogLevel instance.

Browser Support

As mentioned, loglevelnext is a logging library for Node.js and modern browsers, which means the latest versions of the major browsers. When bundling or compiling loglevelnext for use in a browser, you should ensure that appropriate polyfills are used. e.g. Internet Explorer typically requires polyfilling both Symbol and Object.assign.

Attribution

This project originated as a fork of the much-loved loglevel module, but has diverged and has been rewritten, and now shares similarities only in functional intent.

Base Log SVG by Freepik from www.flaticon.com.

Meta

CONTRIBUTING

LICENSE (Mozilla Public License)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].