Skip to content

Commit

Permalink
feat(refacto): Add appenders, layouts and multiple loggings output
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Jun 25, 2017
1 parent 6d3fd29 commit 6ac15a0
Show file tree
Hide file tree
Showing 125 changed files with 27,495 additions and 1,283 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Expand Up @@ -39,6 +39,11 @@ test/*.js
test/*.js.map
/src/*.js
/src/*.js.map

test/**/*.js
test/**/*.js.map
/src/**/*.js
/src/**/*.js.map
/lib
/dts
/es6
Expand All @@ -47,4 +52,5 @@ test/*.js.map
/stdout
/stderr

.DS_Store
.DS_Store
.nyc_output
23 changes: 23 additions & 0 deletions .nycrc
@@ -0,0 +1,23 @@
{
"include": [
"src/**/*.js"
],
"exclude": [
"**/index.ts",
"**/index.js",
"**/interfaces/*.js"
],
"reporter": [
"lcov",
"text-summary"
],
"extension": [
".ts"
],
"check-coverage": true,
"lines": 93,
"statements": 92,
"functions": 86,
"branches": 78,
"all": true
}
22 changes: 18 additions & 4 deletions .travis.yml
Expand Up @@ -2,11 +2,25 @@ language: node_js
node_js:
- '4'
- '5'
- '6'
- '7'
- 'node'

env:
- NODE_ENV=test

cache:
directories:
- "node_modules"

before_script:
- npm prune

before_install:
- npm install -g coveralls@2 nyc@10.3

script:
- "npm test"
- "npm run test:travis"
- npm run test

after_script:
- "test -e ./coverage/lcov.info && npm install coveralls@2 remap-istanbul@0.6.4 && ./node_modules/.bin/remap-istanbul -i ./coverage/coverage.json -t lcovonly | coveralls"
after_success:
- npm run test:travis
9 changes: 9 additions & 0 deletions LICENSE
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2016 Romain Lenzotti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 changes: 38 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,38 @@
## Status
**READY/IN DEVELOPMENT/HOLD**

## Migrations
YES | NO

## Description
A few sentences describing the overall goals of the pull request's commits.

## Usage example
Example to use your feature and to improve the documentation after merging your PR:
```
import {} from "ts-express-decorators";
```

## Related PRs
List related PRs against other branches:

branch | PR
------ | ------
other_pr_production | [link]()
other_pr_master | [link]()


## Todos
- [ ] Tests
- [ ] Documentation


## Deploy Notes
Notes regarding deployment the contained body of work. These should note any
db migrations, etc.

## Impacted Areas in Application
List general components of the application that this PR will affect:

*
Empty file added docs/.nojekyll
Empty file.
78 changes: 78 additions & 0 deletions docs/README.md
@@ -0,0 +1,78 @@
# TsLogDebug

[![Build Status](https://travis-ci.org/Romakita/ts-log-debug.svg?branch=master)](https://travis-ci.org/Romakita/ts-log-debug)
[![Coverage Status](https://coveralls.io/repos/github/Romakita/ts-log-debug/badge.svg?branch=master)](https://coveralls.io/github/Romakita/ts-log-debug?branch=master)
[![TypeScript](https://badges.frapsoft.com/typescript/love/typescript.svg?v=100)](https://github.com/ellerbrock/typescript-badges/)
[![Package Quality](http://npm.packagequality.com/shield/ts-log-debug.png)](http://packagequality.com/#?package=ts-log-debug)
[![npm version](https://badge.fury.io/js/ts-log-debug.svg)](https://badge.fury.io/js/ts-log-debug)
[![Dependencies](https://david-dm.org/romakita/ts-log-debug.svg)](https://david-dm.org/romakita/ts-log-debug#info=dependencies)
[![img](https://david-dm.org/romakita/ts-log-debug/dev-status.svg)](https://david-dm.org/romakita/ts-log-debug/#info=devDependencies)
[![img](https://david-dm.org/romakita/ts-log-debug/peer-status.svg)](https://david-dm.org/romakita/ts-log-debug/#info=peerDependenciess)
[![Known Vulnerabilities](https://snyk.io/test/github/romakita/ts-log-debug/badge.svg)](https://snyk.io/test/github/romakita/ts-express-decorators)

> A multi chanel logger written in TypeScript.
## Features

* Colored console logging to stdout or stderr,
* File appender, with configurable log rolling based on file size or date
* Configurable log message layout/patterns
* Different log levels for different log categories (make some parts of your app log as DEBUG, others only ERRORS, etc.)

Please refer to the [documentation](http://ts-log-debug.github.io) for more details.

## Installation

```bash
npm install -g typescript
npm install ts-log-debug
```

## Breaking change 3.x

Since v3.x, the logger is completely rewritten to support new features. This new version is inspired by the excellent project [log4js](https://github.com/nomiddlename/log4js-node/).

## Quick start

Minimalist version:

```typescript
import {$log} from "ts-log-debug";
$log.level = "debug";
$log.name = "APP";

$log.debug("Some debug messages");
```
Will be procude the following log output:
```
[2017-06-17 11:43:37.987] [DEBUG] [APP] - Some debug messages
```

Create your custom logger:
```typescript
import {Logger} from "ts-log-debug";

const logger = new Logger("loggerName");
logger.appenders
.push({
type: "stdout",
levels: ["debug", "info", "trace"]
})
.push({
type: "stderr",
levels: ["fatal", "error", "warn"],
layout: {
type: "pattern",
pattern: "%d %p %c %X{user} %m%n"
}
})
.push({
type: "file",
filename: `${__dirname}/app.log`,
layout:{
type: "json",
separator: ","
}
})
```

12 changes: 12 additions & 0 deletions docs/_coverpage.md
@@ -0,0 +1,12 @@
<!-- _coverpage.md -->

# TsLogDebug <small>3.0</small>

> A multi chanel logger written in TypeScript.
* Colored console logging,
* Configurable log message layout/patterns.

[GitHub](https://github.com/Romakita/ts-log-debug/)
[Get Started](#tslogdebug)

17 changes: 17 additions & 0 deletions docs/_sidebar.md
@@ -0,0 +1,17 @@
- [Getting Started](getting-started.md)

- Appenders
- [Configuration](appenders.md)

- Layouts
- [Configuration](layouts.md)
- Built-in layouts
- [Basic](layouts/basic.md)
- [Colored](layouts/colored.md)
- [Dummy](layouts/dummy.md)
- [Message Pass-Through](layouts/message-pass-through.md)
- [Json](layouts/json.md)
- [Pattern](layouts/pattern.md)
- [Custom layouts](layouts/custom.md)

- [License](license.md)

0 comments on commit 6ac15a0

Please sign in to comment.