Skip to content
This repository has been archived by the owner on Jul 25, 2021. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian committed May 3, 2019
0 parents commit 2815291
Show file tree
Hide file tree
Showing 12 changed files with 4,269 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
@@ -0,0 +1,8 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
trim_trailing_whitespace = true
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
node_modules
yarn-error.log
dist
.coverage
2 changes: 2 additions & 0 deletions .prettierignore
@@ -0,0 +1,2 @@
.coverage
dist
7 changes: 7 additions & 0 deletions .prettierrc.json
@@ -0,0 +1,7 @@
{
"printWidth": 120,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "all",
"useTabs": true
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,8 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) Brian Faust <hello@basecode.sh>

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.
32 changes: 32 additions & 0 deletions README.md
@@ -0,0 +1,32 @@
# common-logger

> A common interface for reusable Logger implementations in TypeScript.
[![Latest Version](https://badgen.now.sh/npm/v/@faustbrian/common-logger)](https://www.npmjs.com/package/@faustbrian/common-logger)
[![Node Engine](https://badgen.now.sh/npm/node/@faustbrian/common-logger)](https://www.npmjs.com/package/@faustbrian/common-logger)
[![License: MIT](https://badgen.now.sh/badge/license/MIT/green)](https://opensource.org/licenses/MIT)

## Installation

```bash
yarn add @vendor/common-logger
```

## Testing

```bash
yarn test
```

## Security

If you discover a security vulnerability within this package, please send an e-mail to hello@basecode.sh. All security vulnerabilities will be promptly addressed.

## Credits

- [Brian Faust](https://github.com/faustbrian)
- [All Contributors](../../../../contributors)

## License

[MIT](LICENSE) © [Brian Faust](https://basecode.sh)
39 changes: 39 additions & 0 deletions package.json
@@ -0,0 +1,39 @@
{
"name": "@faustbrian/common-logger",
"version": "0.1.0",
"description": "A common interface for reusable Logger implementations in TypeScript.",
"homepage": "https://github.com/faustbrian/common-logger",
"bugs": {
"url": "https://github.com/faustbrian/common-logger/issues"
},
"repository": {
"type": "git",
"url": "git@github.com:faustbrian/common-logger.git"
},
"license": "MIT",
"author": "Brian Faust <hello@basecode.sh>",
"files": [
"dist"
],
"main": "dist/index",
"types": "dist/index",
"scripts": {
"build": "yarn clean && tsc",
"build:watch": "yarn build -w",
"clean": "rimraf .coverage dist tmp",
"format": "yarn lint && yarn prettier",
"lint": "tslint -c tslint.json 'src/**/*.ts' --fix",
"prepublishOnly": "yarn format && yarn build",
"prettier": "prettier --write \"./*.{ts,js,json,md}\" \"./**/*.{ts,js,json,md}\""
},
"devDependencies": {
"@sindresorhus/tsconfig": "^0.3.0",
"@types/jest": "^24.0.11",
"@types/node": "^11.13.7",
"prettier": "^1.17.0",
"rimraf": "^2.6.3",
"tslint": "^5.16.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.4.5"
}
}
47 changes: 47 additions & 0 deletions src/index.ts
@@ -0,0 +1,47 @@
export interface ILogger {
/**
* System is unusable.
*/
emergency<T = any>(message: string, context?: T): void;

/**
* Action must be taken immediately.
*/
alert<T = any>(message: string, context?: T): void;

/**
* Critical conditions.
*/
critical<T = any>(message: string, context?: T): void;

/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*/
error<T = any>(message: string, context?: T): void;

/**
* Exceptional occurrences that are not errors.
*/
warning<T = any>(message: string, context?: T): void;

/**
* Normal but significant events.
*/
notice<T = any>(message: string, context?: T): void;

/**
* Interesting events.
*/
info<T = any>(message: string, context?: T): void;

/**
* Detailed debug information.
*/
debug<T = any>(message: string, context?: T): void;

/**
* Logs with an arbitrary level.
*/
log<T = any>(level: string, message: string, context?: T): void;
}
19 changes: 19 additions & 0 deletions tsconfig.json
@@ -0,0 +1,19 @@
{
"extends": "@sindresorhus/tsconfig",
"compilerOptions": {
"alwaysStrict": true,
"incremental": true,
"lib": ["es2018"],
"module": "commonjs",
"moduleResolution": "node",
"outDir": "dist",
"removeComments": true,
"resolveJsonModule": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "es2018",
"typeRoots": ["node_modules/@types"]
},
"include": ["src/**/**.ts"],
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"]
}
3 changes: 3 additions & 0 deletions tslint.json
@@ -0,0 +1,3 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"]
}

0 comments on commit 2815291

Please sign in to comment.