{"bugs":{"url":"https://github.com/vauxite-org/typescript-logging/issues"},"dist":{"shasum":"e0f8157943780cf5943aacd53b04cb73d108a0f9","tarball":"https://registry.npmjs.org/typescript-logging/-/typescript-logging-1.0.1.tgz","fileCount":221,"integrity":"sha512-zp28ABme0m5q/nXabBaY9Hv/35N8lMH4FsvhpUO0zVi4vFs3uKlb5br2it61HAZF5k+U0aP6E67j0VD0IzXGpQ==","signatures":[{"sig":"MEUCIQCRYsJIPGcf6ZoNy7N2Ey8k6La+ZPswNeaY7XvD48CohQIgO/zUychqLfcCKb/vJoBLmbHC6ug6jDNz3rnsAvndUC8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3149440,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiD6rYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrTdg/+KssF+CotOpK/CatwCTaJGwyqs1UyBHYlUOIvxbqvK7rs1GM/\r\n9EwxXo0Dpsw3xV3WMy/4WujyXTkTZus82gvXj2JceNPLp22O3k5rZylhbwZ4\r\nFVYlNd0GeRArCRlV/hxnQYa0e+LUZclbEMJ5N/et0SMnEGRAx6rYXTTTibAK\r\nQym3cg4Elhm8JIrmAlfV+W/tvwwo4ktTeP5iYZhFG/5FdbDb3YSVUInx6IHy\r\nH6oqmHBf/GeArQg1sV/xTlw+X8/prFoljqzy9P1AMpMJYok0pbu5Z3FxX2sv\r\nJN3kNkhcn9Tn1WMGdp/b+5ai4h/OYQfsSFXXsaNTC+TvcONNvoMaQD4PJLGa\r\ntCUua9w8HJBtMWZIdCe0C9oL/tzsvUTQCUFwmWzjl6HtDOGDEFXIpZzvXrkp\r\nXBewW2nY99a4wBvIYx+vxRaIqjUgJ4lKje5B2mArmXD7cj+GPY/nWAytzo3+\r\ni329zU7AHCD7Co6CvjkXBg7VaSq22gCaaUil7Z4xRdMnYcKuAsjvxPBcubCh\r\nLkf0mM38X2FD5Zy6ew59+xK0eSLAkuLEz+3hs1bjeF/cFAf3ePTYS/LBzf6V\r\nyCHms2Cj+I6lGSSWtnPnnaOiQsmuet4UPCq6Tcrhc6Ce/DZ/aRTjCamD5jiE\r\n5muBfEMdh8Tb248yBCHGneWwEX1nH001f4M=\r\n=+aDr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/commonjs/typescript-logging","name":"typescript-logging","author":{"name":"Martijn Reuvers","email":"martijnr.work@gmail.com"},"readme":"# TypeScript Logging (typescript-logging)\n\nTypeScript library for logging. Simple and flexible in usage.\n\n**This is version 1, TypeScript logging version 2 has been released. You're recommended to upgrade** \n\n* The library is written in TypeScript, so it will easily integrate with other TypeScript projects.\n* Two styles are supported (either can be used or both):\n  * Category style of logging\n  * Log4j style of logging\n* Can run in both the browser and node\n* Api to control (console) logging at runtime through a (browser's) developer console.\n* Supports a separate chrome browser developer extension, which allows you to control logging at runtime through the chrome developer extension. For details please see: [Typescript Logging Developer Extension](#typescript-logging-developer-extension)\n\nThe javascript bundle is es5 compatible.\n\nThe following **documentation** sections are available:\n* [Installation](#installation)\n* [Usage](#usage)\n  * [Category style logging](#category-style-logging)\n  * [Log4j style logging](#log4j-style-logging)\n* [Console control API](#console-control-api)\n* [Documentation](#documentation)\n* [Typescript Logging Developer Extension](#typescript-logging-developer-extension)\n* [Build](#build)\n* [Tests](#tests)\n* [Bugs](#bugs)\n* [Contributing](#contributing)\n* [History and changelog](#history-and-changelog)\n\nNotes: \n* Release 0.6.0 removed several previously deprecated methods e.a, please see the changelog to find out what\n* Build in combination with angular-cli 6.0.0+ may fail, for a workaround see [Issue 36](https://github.com/mreuvers/typescript-logging/issues/36), this has been fixed in later angular-cli versions already.\n\n## Installation\n\nUse npm to install to use in your project.\n\n```bash\nnpm install --save typescript-logging\n```\nNo additional typings are required, these are included.\n\nRequires typescript 4.5.x\n\n### Promise\n\nThe library does NOT ship with a polyfill of Promise anymore, this was done on purpose as shipping with a polyfill\noften leads to conflicts if other projects already have a different promise polyfill included. Also, current browsers\nall support Promise out of the box these days.\n\nSo if you do care about old browsers that do not have Promise support, you must provide one yourself such as e.g. es6-promise.\n\n## Usage\n\nThe library provides two mechanisms for logging, one which looks similar to the widely known log4j like loggers\nand a new more experimental way of logging.\n\nWhich one to use, is a matter of preference, both have advantages and disadvantages.\n\nNote: Currently the chrome developer extension supports \"category style logging\" only.\n\n### Category style logging\n\nThis provides a quick example, please check the documentation section for full documentation.\n\nConfig.ts\n```typescript\nimport {Category,CategoryLogger,CategoryServiceFactory,CategoryConfiguration,LogLevel} from \"typescript-logging\";\n\n// Optionally change default settings, in this example set default logging to Info.\n// Without changing configuration, categories will log to Error.\nCategoryServiceFactory.setDefaultConfiguration(new CategoryConfiguration(LogLevel.Info));\n\n// Create categories, they will autoregister themselves, one category without parent (root) and a child category.\nexport const catService = new Category(\"service\");\nexport const catProd = new Category(\"product\", catService);\n\n// Optionally get a logger for a category, since 0.5.0 this is not necessary anymore, you can use the category itself to log.\n  // export const log: CategoryLogger = CategoryServiceFactory.getLogger(cat);\n```\n\nElseWhere.ts\n```typescript\nimport {catService,catProd} from \"./Config\"\n\nexport class ElseWhere {\n\n  magic(name: string): void {\n     // Normal log to category: catProd\n     catProd.info(\"Performing magic: \" + name);\n\n     // Lambda log to catProd (cheaper)\n     catProd.info(() => \"Performing magic once more: \" + name);\n\n     catService.info(() => `With template script: ${name}`);\n  }\n}\n```\n\nWith the above example if magic(\"spell\") is executed it will log:\n```\n2016-01-07 11:14:26,273 INFO [product] Performing magic: spell\n2016-01-07 11:14:26,274 INFO [product] Performing magic once more: spell\n2016-01-07 11:14:26,275 INFO [service] With template script: spell\n```\n\n### Log4j style logging\n\nThis provides a quick example, please check the documentation section for full documentation.\n\nConfigLog4j.ts\n```typescript\nimport {LoggerFactory, LoggerFactoryOptions, LFService, LogGroupRule, LogLevel} from \"typescript-logging\";\n\n// Create options instance and specify 2 LogGroupRules:\n// * One for any logger with a name starting with model, to log on debug\n// * The second one for anything else to log on info\nconst options = new LoggerFactoryOptions()\n.addLogGroupRule(new LogGroupRule(new RegExp(\"model.+\"), LogLevel.Debug))\n.addLogGroupRule(new LogGroupRule(new RegExp(\".+\"), LogLevel.Info));\n\n// Create a named loggerfactory and pass in the options and export the factory.\n// Named is since version 0.2.+ (it's recommended for future usage)\nexport const factory = LFService.createNamedLoggerFactory(\"LoggerFactory\", options);\n```\n\nElseWhere.ts\n```typescript\nimport {factory} from \"./ConfigLog4j\";\n\n// Retrieve a logger (you can decide to use it per class and/or module or just\n// export it in the config above etc. Your loggers - your choice!).\n// This logger will fall in the first LogGroupRule from above.\nconst log = factory.getLogger(\"model.Product\");\n\n// This logger will fall in the 2nd LogGroupRule\nconst logOther = factory.getLogger(\"somethingElse\");\n\nexport class ElseWhere {\n\n  magic(name: string): void {\n    log.debug(\"Casting debug magic spell: \" + name);\n    logOther.info(\"Casting info magic spell: \" + name);\n\n    // Lamda logging, cheaper as its only executed when needed.\n    log.debug(() => \"Casting lambda debug magic spell: \" + name);\n    logOther.info(() => \"Casting lambda info magic spell: \" + name);\n\n    // Use template script\n    log.info(() => `Casting magic spell: ${name}`);\n  }\n}\n```\n\nWhen the method magic(\"Lumina\") is called on an ElseWhere instance, it will log:\n```\n2017-02-15 20:43:52,807 DEBUG [model.Product] Casting debug magic spell: Lumina\n2017-02-15 20:43:52,809 INFO [somethingElse] Casting info magic spell: Lumina\n2017-02-15 20:43:52,810 DEBUG [model.Product] Casting lambda debug magic spell: Lumina\n2017-02-15 20:43:52,811 INFO [somethingElse] Casting lambda info magic spell: Lumina\n2017-02-15 20:43:52,812 INFO [model.Product] Casting magic spell: Lumina\n```\n\n\n## Console control API\n\nThe framework ships with an API that can be used to control the log settings dynamically, for both the log4j style and category styles of logging.\nThis allows you to change log levels dynamically when an app is e.g. in production already.\n\nFor details how to use this, please read the [console control documentation](docs/latest_console_control.md).\n\n### Exposing console control API when using webpack\n\nWhen using webpack to bundle typescript-logging along, you need to expose it yourself, as webpack bundles the module inside making 'TSL' unavailable.\nPlease read the documentation on page: [Console control documentation](docs/latest_console_control.md) for all details how to do this.\n\n\n## Documentation\n\n[Download](https://github.com/mreuvers/typescript-logging/tree/master/downloads/bundle/latest) all documentation offline including API documentation of classes\nin addition to the normal documentation provided here.\n\nSince version 0.2.0 the documentation has been split off in several sections.\n\n### Api and related\n* Latest category style logging: [Categorized documentation](docs/latest_categorized.md)\n* Latest log4j style logging: [Log4j documentation](docs/latest_log4j.md)\n* Console control api: [Console control documentation](docs/latest_console_control.md)\n\n### Webpack with more than one project module (important)\n\nNote: This section is only relevant if you have multiple projects depending on each other and all need to use typescript-logging.\n\n#### Dependencies\n\nWhenever you use multiple projects, that are packed separately by webpack (thus each results in a separate bundle).\nYou need to make sure to only have typescript-logging packed once in the final module. Not doing so will result\nin undesired unclear behavior. This is since the framework keeps state, and you only want it packed once because of that\nor state will be spread over different modules.\n\nExample:\n\nProject A is a core project (and thus used by other projects as a dependency), this project must make sure\nto *not* pack typescript-logging within it's module by using the external option:\n\n```javascript\nvar webpack = require(\"webpack\");\n\nmodule.exports = {\n    // ... more webpack config here\n\n    externals : {\n      \"typescript-logging\": \"typescript-logging\"\n    }\n\n};\n```\n\nThen project B, that depends on project A should pack typescript-logging along normally\n(which is what webpack normally does if it's a dependency in package.json).\n\n\n## Typescript Logging Developer Extension\n\nStarting with version 0.2.0+ a chrome developer extension is available to easily allow changing log levels and filtering of logging for an application that uses typescript logging.\n\n![Extension screenshot](img/typescript-logging-tab.png)\n\nPlease visit: [typescript-logging-extension](https://github.com/mreuvers/typescript-logging-extension) on how to get this.\n\nNote: The extension currently only integrates with the category style of logging.\n\n## Build\n\nTo build locally:\n\n```bash\nnpm run build\n```\n\n## Tests\n\nTo run the tests:\n\n```bash\nnpm run test\n```\n\n## Bugs\n\nWe all wish there were none in our software, but alas. If you encounter a bug please log it in the issue tracker.\n\n## Contributing\n\nFeel free to contribute or come up with great ideas, please use the issue tracker for that.\n\nIf you add/change new functionality and want it merged to master, please open a pull request. Also add tests for it (spec directory).\n\nSome things may not fit the library and could be rejected, so if you are unsure please ask first before wasting your valuable time!\n\n## History and changelog\n\nFor history, changes and migration please check the [changelog](docs/change_log.md)\n","gitHead":"22a426780d0d6fa5ee290c2880897609cd90ea87","license":"Apache-2.0","scripts":{"docs":"typedoc --tsconfig tsconfig-docs.json --excludePrivate --out dist/bundle/docs/api src/logging/typescript-logging.ts","test":"tsc -p tsconfig-test.json && jasmine-ts --project tsconfig-test.json --config=jasmine.json","build":"tsc && npm run tslint && webpack --config webpack.config.bundle.js && webpack --config webpack.config.bundle-min.js","tslint":"tslint -c tslint.json -p tsconfig.json  && tslint -c tslint.json -p tsconfig-test.json","release":"npm run build && npm run test && npm run tslint && npm run testLoadBundle && npm run docs","testLoadBundle":"webpack --config webpack.config.bundle.node.js && node spec/testLoadUseBundle.js"},"typings":"./dist/commonjs/typescript-logging.d.ts","_npmUser":{"name":"mre","email":"martijnr.work@gmail.com"},"homepage":"https://github.com/vauxite-org/typescript-logging/#readme","keywords":["typescript-logging","logging","javascript-logging","log","logger"],"repository":{"url":"git+https://github.com/vauxite-org/typescript-logging.git","type":"git"},"_npmVersion":"8.3.1","description":"Library for logging, written in typescript, can be used by normal es5+ javascript as well.","directories":{},"maintainers":[{"name":"mre","email":"martijnr.work@gmail.com"}],"_nodeVersion":"16.14.0","dependencies":{"stacktrace-js":"1.3.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tslint":"6.1.3","jasmine":"3.99.0","shelljs":"0.8.5","ts-node":"8.10.2","typedoc":"0.22.11","webpack":"5.69.1","archiver":"5.3.0","ts-loader":"9.2.6","jasmine-ts":"0.4.0","typescript":"4.5.5","webpack-cli":"4.9.2","@types/jasmine":"3.10.3","source-map-loader":"3.0.1","@types/stacktrace-js":"0.0.33","jasmine-spec-reporter":"7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/typescript-logging_1.0.1_1645193944394_0.37063366558477306","host":"s3://npm-registry-packages"},"_id":"typescript-logging@1.0.1","version":"1.0.1"}