gina 0.0.9-p91b → 0.1.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +46 -0
- package/{core/asset/html/static.html → Icon/r} +0 -0
- package/LICENSE +1 -1
- package/README-4Contributors.md +96 -0
- package/README.md +296 -104
- package/bin/cli +287 -0
- package/bin/cli-debug +60 -0
- package/bin/cmd +184 -0
- package/bin/gina +180 -0
- package/config/logger.json +17 -0
- package/doc/framework/cli/doc.json +9 -0
- package/doc/framework/index.md +60 -0
- package/framework/v0.1.1-alpha.2/AUTHORS +7 -0
- package/{core/utils/lib/inherits → framework/v0.1.1-alpha.2}/LICENSE +1 -1
- package/framework/v0.1.1-alpha.2/VERSION +1 -0
- package/{core/locales/dist/language/en.json → framework/v0.1.1-alpha.2/core/asset/html/nolayout.html} +0 -0
- package/{core/locales/dist/language/fr.json → framework/v0.1.1-alpha.2/core/asset/html/static.html} +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/asset/img/android-chrome-192x192.png +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/asset/img/android-chrome-512x512.png +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/asset/img/apple-touch-icon.png +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon-16x16.png +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon-32x32.png +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.js +20904 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.js.map +56 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.css +1 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.css.map +1 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.js +736 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.js.map +56 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.onload.min.js +5 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.onload.min.js.map +8 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/readme.md +192 -0
- package/framework/v0.1.1-alpha.2/core/asset/js/plugin/uuid.json +23 -0
- package/framework/v0.1.1-alpha.2/core/config.js +2308 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/index.js +757 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.js +20 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.v2.js +429 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.v3.js +432 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/n1ql.js +14 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.js +21 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.v2.js +258 -0
- package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.v3.js +341 -0
- package/{core → framework/v0.1.1-alpha.2/core}/controller/controller.framework.js +3 -2
- package/framework/v0.1.1-alpha.2/core/controller/controller.js +3990 -0
- package/{core → framework/v0.1.1-alpha.2/core}/controller/index.js +5 -5
- package/framework/v0.1.1-alpha.2/core/deps/busboy/.travis.yml +17 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/LICENSE +19 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/README.md +225 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/deps/encoding/encoding-indexes.js +73 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/deps/encoding/encoding.js +2391 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/main.js +89 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/types/multipart.js +328 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/types/urlencoded.js +214 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/utils.js +191 -0
- package/framework/v0.1.1-alpha.2/core/deps/busboy/package.json +69 -0
- package/framework/v0.1.1-alpha.2/core/deps/swig-client/swig-2.0.0.min.js +5 -0
- package/{core → framework/v0.1.1-alpha.2/core}/dev/index.js +5 -5
- package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/class.js +1 -1
- package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/factory.js +1 -1
- package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/tools.js +0 -0
- package/framework/v0.1.1-alpha.2/core/gna.js +1070 -0
- package/{core → framework/v0.1.1-alpha.2/core}/locales/README.md +41 -2
- package/{core → framework/v0.1.1-alpha.2/core}/locales/currency.json +0 -0
- package/{core/plugins/README.md → framework/v0.1.1-alpha.2/core/locales/dist/language/en.json} +0 -0
- package/{core/plugins/lib/intl/README.md → framework/v0.1.1-alpha.2/core/locales/dist/language/fr.json} +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/locales/dist/region/en.json +0 -0
- package/framework/v0.1.1-alpha.2/core/locales/dist/region/fr.json +9492 -0
- package/{core → framework/v0.1.1-alpha.2/core}/locales/index.js +5 -4
- package/{core → framework/v0.1.1-alpha.2/core}/locales/src/make.js +15 -12
- package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/currency.csv +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/region.csv +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/region.mapping.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/mime.types +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/model/entity.js +156 -196
- package/{core → framework/v0.1.1-alpha.2/core}/model/index.js +67 -48
- package/{core → framework/v0.1.1-alpha.2/core}/model/template/entityFactory.js +2 -2
- package/{core → framework/v0.1.1-alpha.2/core}/model/template/index.js +8 -10
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.2/core/plugins}/README.md +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/plugins/index.js +3 -3
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.2/core/plugins/lib/file}/README.md +0 -0
- package/{core/plugins/lib/intl → framework/v0.1.1-alpha.2/core/plugins/lib/file}/build.json +0 -0
- package/framework/v0.1.1-alpha.2/core/plugins/lib/file/package.json +25 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.2/core/plugins/lib/intl}/README.md +0 -0
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.2/core/plugins/lib/intl}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/intl/package.json +3 -3
- package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/intl/src/main.js +17 -1
- package/{core/utils/lib/routing → framework/v0.1.1-alpha.2/core/plugins/lib/storage}/README.md +0 -0
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.2/core/plugins/lib/storage}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/storage/package.json +2 -2
- package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/storage/src/main.js +91 -85
- package/{core/utils/lib/url → framework/v0.1.1-alpha.2/core/plugins/lib/validator}/README.md +0 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.2/core/plugins/lib/validator}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/validator/package.json +3 -3
- package/framework/v0.1.1-alpha.2/core/plugins/lib/validator/src/form-validator.js +1762 -0
- package/framework/v0.1.1-alpha.2/core/plugins/lib/validator/src/main.js +6917 -0
- package/framework/v0.1.1-alpha.2/core/router.js +664 -0
- package/framework/v0.1.1-alpha.2/core/server.express.js +213 -0
- package/framework/v0.1.1-alpha.2/core/server.isaac.js +386 -0
- package/framework/v0.1.1-alpha.2/core/server.js +3010 -0
- package/{core → framework/v0.1.1-alpha.2/core}/status.codes +8 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/app.json +6 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/routing.json +11 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/settings.json +9 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/settings.server.json +30 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/templates.json +42 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/controller.content.js +39 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/controller.js +30 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/{core/template/samples → framework/v0.1.1-alpha.2/core/template/boilerplate}/bundle/index.js +0 -0
- package/{core/template/samples/bundle → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_namespace}/controllers/controller.js +9 -7
- package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/css/default.css +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/css/vendor/readme.md +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public/js/vendor/readme.md +1 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public/readme.md +1 -0
- package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/handlers/main.js +24 -0
- package/{core/template/views/html/default.html → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/html/homepage.html} +0 -0
- package/{core/template/views/html/layout.html → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/html/layout/main.html} +2 -2
- package/{core → framework/v0.1.1-alpha.2/core}/template/command/gina.bat.tpl +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/command/gina.tpl +1 -1
- package/framework/v0.1.1-alpha.2/core/template/conf/env.json +76 -0
- package/{core/template/conf/project.json → framework/v0.1.1-alpha.2/core/template/conf/manifest.json} +1 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/conf/package.json +2 -2
- package/framework/v0.1.1-alpha.2/core/template/conf/settings.json +92 -0
- package/framework/v0.1.1-alpha.2/core/template/conf/statics.json +10 -0
- package/framework/v0.1.1-alpha.2/core/template/conf/templates.json +37 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/401.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/403.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/404.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/html/50x.html +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/json/500.json +0 -0
- package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/json/503.json +0 -0
- package/{core/utils/lib/routing/build.json → framework/v0.1.1-alpha.2/core/template/extensions/logger/config.json} +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/helpers/console.js +3 -3
- package/{core/utils → framework/v0.1.1-alpha.2}/helpers/context.js +240 -49
- package/framework/v0.1.1-alpha.2/helpers/dateFormat.js +528 -0
- package/framework/v0.1.1-alpha.2/helpers/index.js +79 -0
- package/framework/v0.1.1-alpha.2/helpers/json/README.md +0 -0
- package/framework/v0.1.1-alpha.2/helpers/json/package.json +20 -0
- package/framework/v0.1.1-alpha.2/helpers/json/src/main.js +97 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/helpers/path.js +342 -140
- package/framework/v0.1.1-alpha.2/helpers/plugins/README.md +4 -0
- package/framework/v0.1.1-alpha.2/helpers/plugins/package.json +20 -0
- package/framework/v0.1.1-alpha.2/helpers/plugins/src/api-error.js +160 -0
- package/framework/v0.1.1-alpha.2/helpers/plugins/src/main.js +32 -0
- package/framework/v0.1.1-alpha.2/helpers/prototypes.js +218 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/helpers/task.js +49 -29
- package/{core/utils → framework/v0.1.1-alpha.2}/helpers/text.js +7 -7
- package/framework/v0.1.1-alpha.2/lib/archiver/README.md +0 -0
- package/framework/v0.1.1-alpha.2/lib/archiver/build.json +0 -0
- package/framework/v0.1.1-alpha.2/lib/archiver/package.json +20 -0
- package/framework/v0.1.1-alpha.2/lib/archiver/src/dep/jszip.min.js +15 -0
- package/framework/v0.1.1-alpha.2/lib/archiver/src/main.js +499 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/aliases.json +13 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/add.js +507 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/arguments.json +4 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/copy.js +15 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/cp.js +2 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/help.js +28 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/help.txt +67 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/list.js +129 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/remove.js +229 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/rename.js +4 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/restart.js +235 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/rm.js +2 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/start.js +394 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/status.js +3 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/bundle/stop.js +232 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/add.js +436 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/get.js +62 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/help.js +28 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/help.txt +33 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/link-dev.js +80 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/list.js +111 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/remove.js +150 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/rm.js +2 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/set.js +57 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/unset.js +44 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/env/use.js +79 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/dot.js +70 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/get.js +0 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/help.js +39 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/help.txt +31 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/init.js +514 -0
- package/{core/utils/lib/cmd → framework/v0.1.1-alpha.2/lib/cmd/framework}/msg.json +3 -3
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/open.js +50 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/restart.js +124 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/set.js +161 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/start.js +96 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/status.js +72 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/stop.js +159 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/tail.js +183 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/update.js +0 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/framework/version.js +44 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/gina-dev.1.md +66 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/gina-framework.1.md +100 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/gina.1.md +79 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/helper.js +1147 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/index.js +170 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/msg.json +20 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/port/help.js +28 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/port/help.txt +31 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/port/inc/scan.js +108 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/port/list.js +176 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/port/set.js +0 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/add.js +528 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/arguments.json +9 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/build.js +115 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/help.js +28 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/help.txt +76 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/import.js +2 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/list.js +55 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/move.js +0 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/remove.js +144 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/rename.js +162 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/restart.js +0 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/rm.js +2 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/start.js +0 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/status.js +3 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/project/stop.js +0 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/protocol/help.js +27 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/protocol/help.txt +57 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/protocol/list.js +239 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/protocol/set.js +631 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/help.js +28 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/help.txt +33 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/link-local.js +80 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/list.js +116 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/remove.js +150 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/rm.js +2 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/set.js +57 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/unset.js +44 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/scope/use.js +79 -0
- package/framework/v0.1.1-alpha.2/lib/cmd/view/add.js +311 -0
- package/framework/v0.1.1-alpha.2/lib/collection/README.md +5 -0
- package/framework/v0.1.1-alpha.2/lib/collection/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/collection/package.json +2 -2
- package/framework/v0.1.1-alpha.2/lib/collection/src/main.js +1459 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/config.js +49 -34
- package/framework/v0.1.1-alpha.2/lib/cron/README.md +7 -0
- package/framework/v0.1.1-alpha.2/lib/cron/package.json +20 -0
- package/framework/v0.1.1-alpha.2/lib/cron/src/main.js +176 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/generator/index.js +8 -4
- package/framework/v0.1.1-alpha.2/lib/index.js +116 -0
- package/framework/v0.1.1-alpha.2/lib/inherits/LICENSE +19 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/protected_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/simple_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/package.json +2 -2
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/src/main.js +18 -19
- package/framework/v0.1.1-alpha.2/lib/logger/README.md +7 -0
- package/framework/v0.1.1-alpha.2/lib/logger/package.json +20 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/containers/default/index.js +55 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/index.js +251 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/lib/logrotator/README.md +100 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/lib/logrotator/index.js +274 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/index.js +52 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/listener.js +302 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/speaker.js +118 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/helper.js +131 -0
- package/framework/v0.1.1-alpha.2/lib/logger/src/main.js +734 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/math/index.js +58 -35
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/README.md +5 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge.js +1 -1
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge_2_literal objects.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge_and_preserve_first.js +2 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/package.json +2 -2
- package/framework/v0.1.1-alpha.2/lib/merge/src/main.js +531 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/model.js +42 -19
- package/framework/v0.1.1-alpha.2/lib/proc.js +518 -0
- package/framework/v0.1.1-alpha.2/lib/routing/README.md +0 -0
- package/framework/v0.1.1-alpha.2/lib/routing/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/routing/package.json +2 -2
- package/framework/v0.1.1-alpha.2/lib/routing/src/main.js +1492 -0
- package/framework/v0.1.1-alpha.2/lib/session-store.js +33 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/shell.js +43 -30
- package/framework/v0.1.1-alpha.2/lib/swig-filters/README.md +0 -0
- package/framework/v0.1.1-alpha.2/lib/swig-filters/package.json +20 -0
- package/framework/v0.1.1-alpha.2/lib/swig-filters/src/main.js +322 -0
- package/framework/v0.1.1-alpha.2/lib/url/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/index.js +2 -1
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/mocks.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/routing.json +9 -9
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/test.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.2}/lib/validator.js +7 -7
- package/framework/v0.1.1-alpha.2/package.json +14 -0
- package/package.json +35 -33
- package/resources/etc/init.d/debian/gina +117 -0
- package/resources/home/framework/env.json +34 -0
- package/resources/home/framework/locals.json +14 -0
- package/resources/home/framework/project.json +48 -0
- package/resources/home/framework/projects.json +6 -0
- package/resources/home/main.json +47 -0
- package/resources/home/settings.json +22 -0
- package/resources/home/user/extensions/logger/default/config.json +77 -0
- package/resources/home/user/extensions/logger/file/config.json +11 -0
- package/resources/img/android-chrome-192x192.png +0 -0
- package/resources/img/android-chrome-512x512.png +0 -0
- package/resources/img/apple-touch-icon.png +0 -0
- package/resources/img/favicon-16x16.png +0 -0
- package/resources/img/favicon-32x32.png +0 -0
- package/resources/img/favicon.ico +0 -0
- package/resources/package.json.template +50 -0
- package/script/lib.js +24 -0
- package/script/post_install.js +449 -157
- package/script/pre_install.js +277 -36
- package/script/prepare_version.js +425 -0
- package/utils/helper.js +438 -0
- package/utils/prototypes.js +239 -0
- package/utils/prototypes.json_clone.js +175 -0
- package/.npmignore +0 -6
- package/MIDDLEWARE +0 -1
- package/SUCCESS +0 -1
- package/VERSION +0 -1
- package/core/asset/html/nolayout.html +0 -1
- package/core/asset/js/plugin/build.dev.json +0 -28
- package/core/asset/js/plugin/build.json +0 -31
- package/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/core/asset/js/plugin/dist/gina.min.js +0 -13731
- package/core/asset/js/plugin/dist/gina.min.js.map +0 -42
- package/core/asset/js/plugin/dist/gina.onload.min.js +0 -3
- package/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/core/asset/js/plugin/readme.md +0 -152
- package/core/asset/js/plugin/src/gina/main.js +0 -132
- package/core/asset/js/plugin/src/gina/popin/css/design.css +0 -23
- package/core/asset/js/plugin/src/gina/popin/css/main.css +0 -1112
- package/core/asset/js/plugin/src/gina/popin/css/popin.css +0 -3
- package/core/asset/js/plugin/src/gina/popin/css/popin.css.map +0 -1
- package/core/asset/js/plugin/src/gina/popin/doc/TOC.md +0 -29
- package/core/asset/js/plugin/src/gina/popin/doc/css.md +0 -162
- package/core/asset/js/plugin/src/gina/popin/doc/extend.md +0 -663
- package/core/asset/js/plugin/src/gina/popin/doc/faq.md +0 -46
- package/core/asset/js/plugin/src/gina/popin/doc/html.md +0 -227
- package/core/asset/js/plugin/src/gina/popin/doc/js.md +0 -37
- package/core/asset/js/plugin/src/gina/popin/doc/misc.md +0 -178
- package/core/asset/js/plugin/src/gina/popin/doc/usage.md +0 -130
- package/core/asset/js/plugin/src/gina/popin/main.js +0 -783
- package/core/asset/js/plugin/src/gina/popin/sass/config.sass +0 -37
- package/core/asset/js/plugin/src/gina/popin/sass/gina-design.sass +0 -622
- package/core/asset/js/plugin/src/gina/popin/sass/gina-popin.sass +0 -54
- package/core/asset/js/plugin/src/gina/popin/sass/helper.scss +0 -73
- package/core/asset/js/plugin/src/gina/toolbar/.npmignore +0 -19
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css +0 -433
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css.map +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/index.html +0 -285
- package/core/asset/js/plugin/src/gina/toolbar/index.kit +0 -120
- package/core/asset/js/plugin/src/gina/toolbar/jquery-3.1.0.min.js +0 -4
- package/core/asset/js/plugin/src/gina/toolbar/main.js +0 -693
- package/core/asset/js/plugin/src/gina/toolbar/mock.gina.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/mock.user.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/readme.md +0 -7
- package/core/asset/js/plugin/src/gina/toolbar/sass/toolbar.sass +0 -563
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/info-optim.svg +0 -13
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/logo-gina.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings-big.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.afdesign +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/test.jpg +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/toolbar.html +0 -104
- package/core/asset/js/plugin/src/gina/utils/dom.js +0 -24
- package/core/asset/js/plugin/src/gina/utils/events.js +0 -201
- package/core/asset/js/plugin/src/gina/utils/loader.js +0 -57
- package/core/asset/js/plugin/src/main.js +0 -235
- package/core/asset/js/plugin/src/vendor/jquery/1.11.1-css-event_alias.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/1.12.4.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/2.1.1-css-event_alias-sizzle.min.js +0 -4
- package/core/asset/js/plugin/src/vendor/jquery/README.md +0 -14
- package/core/asset/js/plugin/src/vendor/jquery/slim-3.1.1.min.js +0 -4
- package/core/config.js +0 -1225
- package/core/controller/controller.js +0 -1860
- package/core/gna.js +0 -908
- package/core/plugins/lib/validator/src/form-validator.js +0 -788
- package/core/plugins/lib/validator/src/main.js +0 -2056
- package/core/router.js +0 -717
- package/core/server.js +0 -1363
- package/core/template/conf/env.json +0 -70
- package/core/template/conf/settings.json +0 -48
- package/core/template/conf/statics.json +0 -6
- package/core/template/conf/views.json +0 -16
- package/core/template/samples/bundle/config/app.json +0 -4
- package/core/template/samples/bundle/config/routing.json +0 -9
- package/core/template/samples/bundle/controllers/setup.js +0 -33
- package/core/template/views/js/vendor/readme.md +0 -1
- package/core/template/views/readme.md +0 -1
- package/core/utils/helpers/dateFormat.js +0 -264
- package/core/utils/helpers/index.js +0 -202
- package/core/utils/index.js +0 -75
- package/core/utils/lib/cmd/app.js +0 -686
- package/core/utils/lib/cmd/basic.help.txt +0 -40
- package/core/utils/lib/cmd/basic.js +0 -141
- package/core/utils/lib/cmd/gina-add-bundle.js +0 -328
- package/core/utils/lib/cmd/gina-add-views.js +0 -99
- package/core/utils/lib/cmd/gina-build.js +0 -218
- package/core/utils/lib/cmd/gina-clean.js +0 -26
- package/core/utils/lib/cmd/gina-connect.js +0 -176
- package/core/utils/lib/cmd/gina-delete-bundle.js +0 -176
- package/core/utils/lib/cmd/gina-deploy.js +0 -452
- package/core/utils/lib/cmd/gina-init-project.js +0 -83
- package/core/utils/lib/cmd/gina-start-bundle.js +0 -3
- package/core/utils/lib/cmd/gina-start.js +0 -3
- package/core/utils/lib/cmd/index.js +0 -157
- package/core/utils/lib/cmd/project.js +0 -14
- package/core/utils/lib/collection/src/main.js +0 -650
- package/core/utils/lib/logger/containers/file.js +0 -11
- package/core/utils/lib/logger/index.js +0 -260
- package/core/utils/lib/merge/src/main.js +0 -344
- package/core/utils/lib/proc.js +0 -416
- package/core/utils/lib/routing/src/main.js +0 -165
- package/documentation/css/default.css +0 -3
- package/documentation/html/home.html +0 -6
- package/documentation/html/inc/_footer.html +0 -5
- package/documentation/html/layout.html +0 -21
- package/documentation/img/debug-conf1.png +0 -0
- package/documentation/img/debug-conf2.png +0 -0
- package/documentation/img/debug-conf3.png +0 -0
- package/documentation/img/debug-conf4.png +0 -0
- package/documentation/img/debug-conf5.png +0 -0
- package/documentation/img/debug-conf6.png +0 -0
- package/documentation/img/debug-conf7.png +0 -0
- package/documentation/img/debug-new1.png +0 -0
- package/documentation/img/debug-new2.png +0 -0
- package/documentation/img/debug-start.png +0 -0
- package/documentation/md/api/controller/main.md +0 -74
- package/migration_note.md +0 -7
- package/package-lock.json +0 -611
- package/script/pre_publish.js +0 -207
- package/tutorial/Commands/README.md +0 -56
- package/tutorial/Commands/add-bundle-result.png +0 -0
- package/tutorial/Commands/add-bundle.png +0 -0
- package/tutorial/Commands/delete-bundle.png +0 -0
- package/tutorial/Commands/help.png +0 -0
- package/tutorial/Commands/init-project.png +0 -0
- package/tutorial/Commands/start-bundle-result.png +0 -0
- package/tutorial/Commands/start-bundle-stop.png +0 -0
- package/tutorial/Commands/start-bundle.png +0 -0
- package/tutorial/Commands/version.png +0 -0
- package/tutorial/ETC/README.md +0 -74
- package/tutorial/ETC/add-bundle-result.png +0 -0
- package/tutorial/ETC/add-bundle.png +0 -0
- package/tutorial/ETC/init-project.png +0 -0
- package/tutorial/Install/README.md +0 -54
- package/tutorial/Install/git-get.png +0 -0
- package/tutorial/Install/git-install-end.png +0 -0
- package/tutorial/Install/git-install-result.png +0 -0
- package/tutorial/Install/git-install-start.png +0 -0
- package/tutorial/Install/install-end.png +0 -0
- package/tutorial/Install/install-result.png +0 -0
- package/tutorial/Install/install-start.png +0 -0
- package/tutorial/WebStorm/README.md +0 -30
- package/tutorial/WebStorm/closure-compiler.png +0 -0
- package/tutorial/WebStorm/sass.png +0 -0
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* This file is part of the gina package.
|
|
4
|
+
* Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
// Imports
|
|
10
|
+
var fs = require('fs');
|
|
11
|
+
var util = require('util');
|
|
12
|
+
var promisify = util.promisify;
|
|
13
|
+
const { EventEmitter } = require('events');
|
|
14
|
+
|
|
15
|
+
// During initial pre-install & post-install, `colors` might not be installed !
|
|
16
|
+
var colors = null;
|
|
17
|
+
var frameworkPath = __dirname +'/../../../../..';
|
|
18
|
+
try {
|
|
19
|
+
colors = require('colors') || require(frameworkPath +'/node_modules/colors');
|
|
20
|
+
} catch (err) {
|
|
21
|
+
// colors not found
|
|
22
|
+
// It is ok, since this case is handled by the `pre-install` script
|
|
23
|
+
throw err
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var merge = require('../../merge');
|
|
27
|
+
var inherits = require('../../inherits');
|
|
28
|
+
var helpers = require('../../../helpers');
|
|
29
|
+
|
|
30
|
+
// BO - publishing hack
|
|
31
|
+
if ( typeof(JSON.clone) == 'undefined' ) {
|
|
32
|
+
require(__dirname +'/../../../helpers/prototypes')()
|
|
33
|
+
}
|
|
34
|
+
if ( typeof(_) == 'undefined' ) {
|
|
35
|
+
require(__dirname +'/../../../helpers/path')()
|
|
36
|
+
}
|
|
37
|
+
if ( typeof(requireJSON) == 'undefined' ) {
|
|
38
|
+
require(__dirname +'/../../../helpers/json')()
|
|
39
|
+
}
|
|
40
|
+
if ( typeof(getContext) == 'undefined' ) {
|
|
41
|
+
require(__dirname +'/../../../helpers/context')()
|
|
42
|
+
}
|
|
43
|
+
// EO - publishing hack
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @class Logger
|
|
48
|
+
*
|
|
49
|
+
* @package gina.lib
|
|
50
|
+
* @namesame gina.lib.logger
|
|
51
|
+
* @author Rhinostone <contact@gina.io>
|
|
52
|
+
*
|
|
53
|
+
* @api Public
|
|
54
|
+
* */
|
|
55
|
+
function Logger() {
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// retrieve context
|
|
59
|
+
var ctx = getContext('loggerInstance') || { initialized: false }; // jshint ignore:line
|
|
60
|
+
|
|
61
|
+
var self = {}
|
|
62
|
+
, loggers = {}
|
|
63
|
+
// `containers`, also meaning transports
|
|
64
|
+
, containers = {}
|
|
65
|
+
// for `getInstance()`
|
|
66
|
+
, opt = ctx._options || {}
|
|
67
|
+
;
|
|
68
|
+
|
|
69
|
+
// only used for defaultOption init
|
|
70
|
+
var homeDir = null
|
|
71
|
+
// user options
|
|
72
|
+
, userOptions = ctx._userOptions || null
|
|
73
|
+
, flowsOptions = ctx._flowsOptions || {}
|
|
74
|
+
, shortVersion = null
|
|
75
|
+
, defaultLogLevel = null
|
|
76
|
+
;
|
|
77
|
+
try {
|
|
78
|
+
homeDir = getUserHome() || process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];// jshint ignore:line
|
|
79
|
+
homeDir += '/.gina';
|
|
80
|
+
shortVersion = requireJSON( _(frameworkPath +'/package.json', true) ).version;// jshint ignore:line
|
|
81
|
+
shortVersion = shortVersion.split('.').splice(0,2).join('.').replace(/^v/, '');
|
|
82
|
+
defaultLogLevel = requireJSON( _(homeDir +'/'+ shortVersion +'/settings.json', true) ).log_level;// jshint ignore:line
|
|
83
|
+
} catch(logLevelError) {
|
|
84
|
+
// It is ok to fail ... do not worry
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
var defaultOptions = ctx._defaultOptions || {
|
|
89
|
+
// Group name by default: it is usually the application or the service PROC.title
|
|
90
|
+
name: 'gina',
|
|
91
|
+
template: '[%d] [%s][%a] %m',
|
|
92
|
+
|
|
93
|
+
// Where the events flow will be dispatched - e.g.: event.on('logger#<container_name>', function(appName, code, severityLevel, content){ ... })
|
|
94
|
+
// A `flow` is binded to related container
|
|
95
|
+
// `default` is `process.stdout`
|
|
96
|
+
// `mq` is for message dispatching: from speakers to the main listener
|
|
97
|
+
// A flow name is always the same as the container/transport name: checkout the `containers` folder for more
|
|
98
|
+
// Don't touch this part!
|
|
99
|
+
flows: ['default', 'mq'],
|
|
100
|
+
// Levels are based on Syslog: https://en.wikipedia.org/wiki/Syslog
|
|
101
|
+
levels : {
|
|
102
|
+
// will also kill the process
|
|
103
|
+
emerg: {
|
|
104
|
+
code: 0,
|
|
105
|
+
label: 'Emergency',
|
|
106
|
+
description: 'System is unusable.',
|
|
107
|
+
color: 'magenta'
|
|
108
|
+
},
|
|
109
|
+
// Only used to send email or trigger a push to an alert system
|
|
110
|
+
alert: {
|
|
111
|
+
code: 1,
|
|
112
|
+
label: 'Alert',
|
|
113
|
+
description: 'Action must be taken immediately.',
|
|
114
|
+
color:'red'
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
crit: {
|
|
118
|
+
code: 2,
|
|
119
|
+
label: 'Critical',
|
|
120
|
+
description: 'Critical conditions.',
|
|
121
|
+
color: 'magenta'
|
|
122
|
+
},
|
|
123
|
+
// deprecated
|
|
124
|
+
error : {
|
|
125
|
+
code: 3,
|
|
126
|
+
label: 'Error',
|
|
127
|
+
description: 'Error conditions.',
|
|
128
|
+
color : 'red',
|
|
129
|
+
deprecated: 'Use `console.err` instead'
|
|
130
|
+
},
|
|
131
|
+
err : {
|
|
132
|
+
code: 3,
|
|
133
|
+
label: 'Error',
|
|
134
|
+
description: 'Error conditions.',
|
|
135
|
+
color : 'red'
|
|
136
|
+
},
|
|
137
|
+
// deprecated
|
|
138
|
+
warn : {
|
|
139
|
+
code: 4,
|
|
140
|
+
label: 'Warning',
|
|
141
|
+
description: 'Warning conditions.',
|
|
142
|
+
color: 'yellow',
|
|
143
|
+
deprecated: 'Use `console.warning` instead'
|
|
144
|
+
},
|
|
145
|
+
warning : {
|
|
146
|
+
code: 4,
|
|
147
|
+
label: 'Warning',
|
|
148
|
+
description: 'Warning conditions.',
|
|
149
|
+
color: 'yellow'
|
|
150
|
+
},
|
|
151
|
+
// notice is use in the framework to raise flags that can be picked-up by child processes (CLI, Bundle, Workers)
|
|
152
|
+
notice: {
|
|
153
|
+
code: 5,
|
|
154
|
+
label: 'Notice',
|
|
155
|
+
description: 'Normal but significant condition.',
|
|
156
|
+
color: 'black'
|
|
157
|
+
},
|
|
158
|
+
info : {
|
|
159
|
+
code: 6,
|
|
160
|
+
label: 'Informational',
|
|
161
|
+
description: 'Informational messages.',
|
|
162
|
+
color: 'cyan'
|
|
163
|
+
},
|
|
164
|
+
debug : {
|
|
165
|
+
code: 7,
|
|
166
|
+
label: 'Debug',
|
|
167
|
+
description: 'Debug-level messages.',
|
|
168
|
+
color: 'gray'
|
|
169
|
+
},
|
|
170
|
+
// hidden level
|
|
171
|
+
catch : {
|
|
172
|
+
code: -1,
|
|
173
|
+
label: 'Catch',
|
|
174
|
+
description: 'Unhandled or already formated messages.',
|
|
175
|
+
color: 'gray'
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
// logging hierarchy
|
|
179
|
+
// Descriptions from https://sematext.com/blog/logging-levels/
|
|
180
|
+
// start with the app log_level, then gina log_level, and if nothing is found, set it by default to info
|
|
181
|
+
// eg.:
|
|
182
|
+
// [ From the CLI ]
|
|
183
|
+
// $ gina set --log-level=trace
|
|
184
|
+
// This will apply for the framework, and will be inherited for all bundles unless you ovveride it in your application/bundle code
|
|
185
|
+
// ----
|
|
186
|
+
// [ Inside your code ]
|
|
187
|
+
// var utils = require('gina').utils;
|
|
188
|
+
// var console = utils.logger;
|
|
189
|
+
// console.setLevel('trace', bundleName) - Put that in the bundle bootstrap
|
|
190
|
+
hierarchy: process.env.LOG_LEVEL || defaultLogLevel || 'info', // by default: info
|
|
191
|
+
hierarchies: {
|
|
192
|
+
/**
|
|
193
|
+
* TRACE
|
|
194
|
+
* The most fine-grained information only used in rare cases where you need the full visibility
|
|
195
|
+
* of what is happening in your application and inside the third-party libraries that you use.
|
|
196
|
+
* Expect the TRACE logging level to be very verbose
|
|
197
|
+
*/
|
|
198
|
+
trace: [0,1,2,3,4,5,6,7], // we want it all
|
|
199
|
+
/**
|
|
200
|
+
* DEBUG
|
|
201
|
+
* Should be used for information that may be needed for diagnosing issues and troubleshooting
|
|
202
|
+
* or when running application in the test environment
|
|
203
|
+
*/
|
|
204
|
+
debug: [0,1,2,3,4,5,6,7],
|
|
205
|
+
/**
|
|
206
|
+
* INFO
|
|
207
|
+
* The standard log level indicating that something happened.
|
|
208
|
+
* Should be purely informative and not looking into them on a regular basis shouldn’t result in
|
|
209
|
+
* missing any important information.
|
|
210
|
+
*/
|
|
211
|
+
info: [0,1,2,3,4,5,6],
|
|
212
|
+
/**
|
|
213
|
+
* WARN
|
|
214
|
+
* Indicates that something unexpected happened in the application, a problem, or a situation that might
|
|
215
|
+
* disturb one of the processes. But that doesn’t mean that the application failed.
|
|
216
|
+
*/
|
|
217
|
+
warn: [0,1,2,3,4,5],
|
|
218
|
+
/**
|
|
219
|
+
* ERROR
|
|
220
|
+
* Should be used when the application hits an issue preventing one or more functionalities from properly
|
|
221
|
+
* functioning.
|
|
222
|
+
*/
|
|
223
|
+
error: [0,1,2,3,5],
|
|
224
|
+
/**
|
|
225
|
+
* FATAL
|
|
226
|
+
* Tells that the application encountered an event or entered a state in which one of the
|
|
227
|
+
* crucial business functionality is no longer working.
|
|
228
|
+
*/
|
|
229
|
+
fatal: [0,1,2,5]
|
|
230
|
+
/**
|
|
231
|
+
* OFF
|
|
232
|
+
* Simple enough. NO LOGGING !!
|
|
233
|
+
*/
|
|
234
|
+
//off: [5]
|
|
235
|
+
},
|
|
236
|
+
isReporting: true
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
var getInstance = function() {
|
|
240
|
+
self = ctx.instance;
|
|
241
|
+
loggers = ctx._loggers;
|
|
242
|
+
// opt = ctx._options;
|
|
243
|
+
|
|
244
|
+
return self;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* init
|
|
249
|
+
* @constructor
|
|
250
|
+
* */
|
|
251
|
+
var init = function(opt) {
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
if ( typeof(ctx.initialized) != 'undefined' && ctx.initialized == true) {
|
|
255
|
+
getInstance();
|
|
256
|
+
// process.env.NODE_ENV
|
|
257
|
+
if (opt.hierarchies[opt.hierarchy].indexOf( opt.levels['debug'].code) > -1) {
|
|
258
|
+
emit(opt, 'debug', 'Logger instance already exists: reusing it ;)');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return self;
|
|
262
|
+
}
|
|
263
|
+
ctx.initialized = true;
|
|
264
|
+
|
|
265
|
+
// user main options & flows options
|
|
266
|
+
var extPath = _(homeDir +'/user/extensions/logger', true)
|
|
267
|
+
var optionsPath = _(extPath +'/default/config.json', true);
|
|
268
|
+
if ( new _(optionsPath).existsSync() ) {
|
|
269
|
+
userOptions = requireJSON(optionsPath);// jshint ignore:line
|
|
270
|
+
if (userOptions.flows && userOptions.flows.length > 0) {
|
|
271
|
+
if (userOptions.flows.indexOf('default') > -1) {
|
|
272
|
+
userOptions.flows.splice(userOptions.flows.indexOf('default'), 1)
|
|
273
|
+
}
|
|
274
|
+
if (userOptions.flows.indexOf('mq') > -1) {
|
|
275
|
+
userOptions.flows.splice(userOptions.flows.indexOf('mq'), 1)
|
|
276
|
+
}
|
|
277
|
+
if (userOptions.flows.length > 0) {
|
|
278
|
+
for (let i = 0, len = userOptions.flows.length; i < len; i++) {
|
|
279
|
+
let flowName = userOptions.flows[i];
|
|
280
|
+
if ( new _(extPath +'/'+ flowName +'/config.json', true).existsSync() ) {
|
|
281
|
+
let flowOpt = requireJSON(_(extPath +'/'+ flowName +'/config.json', true));// jshint ignore:line
|
|
282
|
+
flowsOptions[flowName] = flowOpt;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// setting up `opt`
|
|
289
|
+
// this is done to repespect arrays order
|
|
290
|
+
var newDefaultOptions = merge(JSON.clone(defaultOptions), userOptions);
|
|
291
|
+
defaultOptions = JSON.clone(newDefaultOptions);
|
|
292
|
+
newDefaultOptions = null;
|
|
293
|
+
if (userOptions && userOptions.flows) {
|
|
294
|
+
delete userOptions.flows;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
opt = merge(userOptions, defaultOptions);
|
|
298
|
+
// if ( new _(optionsPath).existsSync() ) {
|
|
299
|
+
// if (userOptions.flows.indexOf('mq') < 0) {
|
|
300
|
+
// userOptions.flows.splice(0, 0, 'mq')
|
|
301
|
+
// }
|
|
302
|
+
// if (userOptions.flows.indexOf('default') < 0) {
|
|
303
|
+
// userOptions.flows.splice(0, 0, 'default')
|
|
304
|
+
// }
|
|
305
|
+
// }
|
|
306
|
+
|
|
307
|
+
// if (opt) {
|
|
308
|
+
// opt = merge(options, JSON.clone(defaultOptions), opt, true)
|
|
309
|
+
// } else {
|
|
310
|
+
// //opt = ( typeof(ctx.instance) != 'undefined' && typeof(ctx.instance._options) != 'undefined' ) ? ctx.instance._options : defaultOptions;
|
|
311
|
+
// opt = JSON.clone(defaultOptions)
|
|
312
|
+
// }
|
|
313
|
+
|
|
314
|
+
if ( typeof(opt.name) == 'undefined' || /^gina\-/.test(opt.name) ) {
|
|
315
|
+
opt.name = 'gina'
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if ( typeof(loggers[opt.name]) == 'undefined' ) {
|
|
319
|
+
// defining default prototypes
|
|
320
|
+
loggers[opt.name] = {}
|
|
321
|
+
}
|
|
322
|
+
loggers[opt.name]._options = opt;
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
// setup default group, colors
|
|
327
|
+
setupNewGroup(opt.name, opt);
|
|
328
|
+
|
|
329
|
+
for (let l in opt.levels) {
|
|
330
|
+
// don't override here since it is generic
|
|
331
|
+
if ( typeof(self[l]) == 'undefined' ) {
|
|
332
|
+
self[l] = function(){// jshint ignore:line
|
|
333
|
+
|
|
334
|
+
let group = opt.name || defaultOptions.name; // by default
|
|
335
|
+
if ( process.title != 'node' && !/(\\|\/)*node$/.test(process.title) ) {
|
|
336
|
+
group = process.title.replace(/^gina\:\s*/, '');
|
|
337
|
+
if ( typeof(group) == 'undefined' || /^gina\-/.test(group) ) {
|
|
338
|
+
group = 'gina'
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
//self.log('--> '+ group + ' '+ process.env.LOG_GROUP +' '+ process.title);
|
|
343
|
+
if ( typeof(loggers[group]) == 'undefined' ) {
|
|
344
|
+
setupNewGroup(group)
|
|
345
|
+
}
|
|
346
|
+
loggers[group][l].apply(self[l], arguments)
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
// TODO - load container/flow if !== `default`
|
|
353
|
+
try {
|
|
354
|
+
// only afer this, we can send logs to containers/transports
|
|
355
|
+
loadContainers(opt, flowsOptions);
|
|
356
|
+
} catch (err) {
|
|
357
|
+
throw err;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
// backing up context
|
|
362
|
+
ctx.instance = self;
|
|
363
|
+
ctx._options = opt;
|
|
364
|
+
ctx._defaultOptions = defaultOptions;
|
|
365
|
+
ctx._flowsOptions = flowsOptions;
|
|
366
|
+
ctx._loggers = loggers;
|
|
367
|
+
setContext('loggerInstance', ctx);// jshint ignore:line
|
|
368
|
+
|
|
369
|
+
if (opt.hierarchies[opt.hierarchy].indexOf( opt.levels['debug'].code) > -1) {
|
|
370
|
+
emit(opt, 'debug', 'New Logger instance created');
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return self;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
var loadContainers = function(opt, flowsOptions) {
|
|
379
|
+
var containersPath = _(__dirname +'/containers', true);// jshint ignore:line
|
|
380
|
+
for (let i=0, len=opt.flows.length; i<len; i++) {
|
|
381
|
+
let flow = opt.flows[i];
|
|
382
|
+
let loggerOptions = JSON.clone(opt);
|
|
383
|
+
if ( typeof(containers[flow]) == 'undefined' ) {
|
|
384
|
+
if ( typeof(flowsOptions[flow]) != 'undefined' ) {
|
|
385
|
+
loggerOptions = merge(loggerOptions, flowsOptions[flow], true);
|
|
386
|
+
}
|
|
387
|
+
containers[flow] = require( _(containersPath +'/'+ flow, true))(loggerOptions, loggers);// jshint ignore:line
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
*
|
|
394
|
+
*
|
|
395
|
+
* @param {string} group
|
|
396
|
+
* @param {object} [opt]
|
|
397
|
+
*/
|
|
398
|
+
var setupNewGroup = function(group, opt) {
|
|
399
|
+
if ( typeof(loggers[group]) == 'undefined' ) {
|
|
400
|
+
loggers[group] = {};
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (!opt) {
|
|
404
|
+
opt = ctx._options || JSON.clone(defaultOptions)
|
|
405
|
+
}
|
|
406
|
+
loggers[group]._options = opt;
|
|
407
|
+
|
|
408
|
+
// lock group name
|
|
409
|
+
loggers[group]._options.name = group;
|
|
410
|
+
|
|
411
|
+
// setup colors
|
|
412
|
+
setColors(group);
|
|
413
|
+
|
|
414
|
+
//setup default levels for the group
|
|
415
|
+
setDefaultLevels(group);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
var setColors = function(group) {
|
|
419
|
+
// using colors module, but we can add support for other modules
|
|
420
|
+
if (colors) {
|
|
421
|
+
var _colors = {};
|
|
422
|
+
for (let k in colors.styles) {
|
|
423
|
+
_colors[k] = {};
|
|
424
|
+
for (let i in colors.styles[k]) {
|
|
425
|
+
_colors[k][i] = colors.styles[k][i]
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
loggers[group].colors = JSON.clone(_colors);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
var setDefaultLevels = function(group) {
|
|
435
|
+
|
|
436
|
+
var loggerOptions = loggers[group]._options || ctx._options || JSON.clone(defaultOptions);
|
|
437
|
+
var logger = loggers[group];
|
|
438
|
+
try {
|
|
439
|
+
|
|
440
|
+
//console.log('colors ----> ', colors);
|
|
441
|
+
// setting default level string length
|
|
442
|
+
loggerOptions._maxLevelLen = loggerOptions._maxLevelLen || 0;
|
|
443
|
+
if (!loggerOptions._maxLevelLen) {
|
|
444
|
+
for (let l in loggerOptions.levels) {
|
|
445
|
+
if (l.length > loggerOptions._maxLevelLen) {
|
|
446
|
+
loggerOptions._maxLevelLen = l.length;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
for (let l in loggerOptions.levels) {
|
|
452
|
+
// override if existing
|
|
453
|
+
logger[l] = new Function('return '+ write +'('+ JSON.stringify(loggerOptions) +', '+ parse +', "'+ l +'", arguments, '+ emit +');');// jshint ignore:line
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
} catch (err) {
|
|
457
|
+
//process.stdout.write(err.stack + '\n')
|
|
458
|
+
emit(opt, 'error', err.stack);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
var write = function(opt, parse, s, args, cb) {
|
|
466
|
+
// caller is __stack[3]
|
|
467
|
+
//console.log("----->" + __stack.toString().replace(/\,/g, '\n') );
|
|
468
|
+
// console.log("----->" + __stack[3] );
|
|
469
|
+
// if ( /tail\.js/.test(__stack[3]) ) {
|
|
470
|
+
// return;
|
|
471
|
+
// }
|
|
472
|
+
|
|
473
|
+
var content = '';
|
|
474
|
+
// Ignore logs not in hierarchy
|
|
475
|
+
if (opt.hierarchies[opt.hierarchy].indexOf( opt.levels[s].code) < 0) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
//To handle logs with coma separated arguments.
|
|
480
|
+
for (let i = 0, iLen = args.length; i < iLen; ++i) {
|
|
481
|
+
|
|
482
|
+
if (args[i] instanceof Function) {
|
|
483
|
+
content += args[i].toString() + ""
|
|
484
|
+
}
|
|
485
|
+
else if (args[i] instanceof Object) {
|
|
486
|
+
// careful, [ parse ] will be out of the main execution context: passing it for recursive use
|
|
487
|
+
content += parse(parse, args[i], "")
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
|
|
491
|
+
if ( /(?:\\[rnt]|[\r\n\t])/.test(args[i]) ) { // special replacement for mixed string
|
|
492
|
+
args[i] = args[i]
|
|
493
|
+
.replace(/(?:\\[rn]|[\r\n])/gm, String.fromCharCode('10')) // \r 10, but should be 13, but will be 10 because of the terminal
|
|
494
|
+
.replace(/(?:\\[t]|[\t])/gm, String.fromCharCode('09'))
|
|
495
|
+
;
|
|
496
|
+
/**
|
|
497
|
+
* Oct Dec Hex Char
|
|
498
|
+
* ─────────────────────────────────────────────
|
|
499
|
+
* 000 0 00 NUL '\0'
|
|
500
|
+
* 001 1 01 SOH (start of heading)
|
|
501
|
+
* 002 2 02 STX (start of text)
|
|
502
|
+
* 003 3 03 ETX (end of text)
|
|
503
|
+
* 004 4 04 EOT (end of transmission)
|
|
504
|
+
* 005 5 05 ENQ (enquiry)
|
|
505
|
+
* 006 6 06 ACK (acknowledge)
|
|
506
|
+
* 007 7 07 BEL '\a' (bell)
|
|
507
|
+
* 010 8 08 BS '\b' (backspace)
|
|
508
|
+
* 011 9 09 HT '\t' (horizontal tab)
|
|
509
|
+
* 012 10 0A LF '\n' (new line)
|
|
510
|
+
* 013 11 0B VT '\v' (vertical tab)
|
|
511
|
+
* 014 12 0C FF '\f' (form feed)
|
|
512
|
+
* 015 13 0D CR '\r' (carriage ret)
|
|
513
|
+
*/
|
|
514
|
+
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
content += args[i] + ' '
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
if (content != '') {
|
|
523
|
+
//process.stdout.write('FLOW: '+ opt.flows + '\n');
|
|
524
|
+
// Forwarding flow to containers
|
|
525
|
+
if (s == 'catch') {
|
|
526
|
+
cb(opt, s, content, true);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
cb(opt, s, content);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
// Forwarding flow to containers
|
|
533
|
+
var emit = function(opt, severity, content, skipFormating) {
|
|
534
|
+
|
|
535
|
+
skipFormating = (typeof(skipFormating) != 'undefined' && /true/i.test(skipFormating)) ? true : false;
|
|
536
|
+
// Sample of a payload
|
|
537
|
+
// process.emit('logger#default', JSON.stringify({
|
|
538
|
+
// group : group,
|
|
539
|
+
// level : severity,
|
|
540
|
+
// content : content
|
|
541
|
+
// }));
|
|
542
|
+
for (let i=0, len=opt.flows.length; i<len; i++) {
|
|
543
|
+
let container = opt.flows[i];
|
|
544
|
+
process.emit('logger#'+container, JSON.stringify({
|
|
545
|
+
group : opt.name,
|
|
546
|
+
level : severity,
|
|
547
|
+
// Raw content !
|
|
548
|
+
content : content,
|
|
549
|
+
skipFormating: skipFormating
|
|
550
|
+
}));
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
var parse = function(parse, obj, str) {
|
|
555
|
+
|
|
556
|
+
var l = 0
|
|
557
|
+
, len = obj.count()
|
|
558
|
+
, isArray = (obj instanceof Array) ? true : false
|
|
559
|
+
;
|
|
560
|
+
str += (isArray) ? '[ ' : '{';
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
for (var attr in obj) {
|
|
564
|
+
++l;
|
|
565
|
+
if (obj[attr] instanceof Function) {
|
|
566
|
+
str += attr +': [Function]';
|
|
567
|
+
// if you want ot have it all replace by the following line
|
|
568
|
+
//str += attr +':'+ obj[attr].toString();
|
|
569
|
+
str += (l<len) ? ', ' : ''
|
|
570
|
+
} else if (obj[attr] instanceof Object && !isArray) {
|
|
571
|
+
str += '"'+attr+'": ';
|
|
572
|
+
str = parse(parse, obj[attr], str);
|
|
573
|
+
str += (l<len) ? ', ' : '';
|
|
574
|
+
} else {
|
|
575
|
+
if (!isArray && typeof(obj[attr]) == 'string') {
|
|
576
|
+
str += '"'+attr+'": "' + obj[attr]
|
|
577
|
+
.replace(/\'/g, "\\'")
|
|
578
|
+
.replace(/\"/g, '\\"') +'"';
|
|
579
|
+
} else if (isArray) {
|
|
580
|
+
str += ( typeof(obj[attr]) != 'string' ) ? obj[attr] : '"'+ obj[attr] +'"'
|
|
581
|
+
} else {
|
|
582
|
+
str += '"'+attr+'": ' + obj[attr]
|
|
583
|
+
}
|
|
584
|
+
str += (l<len) ? ', ' : ''
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
str += (isArray) ? ' ]' : '}';
|
|
590
|
+
return str + ' ';
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
self.getOptions = function() {
|
|
594
|
+
var loggerOptions = null, opt = ctx._options;
|
|
595
|
+
for (let i=0, len=opt.flows.length; i<len; i++) {
|
|
596
|
+
let flow = opt.flows[i];
|
|
597
|
+
loggerOptions = JSON.clone(opt);
|
|
598
|
+
if ( typeof(ctx._flowsOptions[flow]) != 'undefined' ) {
|
|
599
|
+
loggerOptions = merge(loggerOptions, ctx._flowsOptions[flow], true);// jshint ignore:line
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return loggerOptions
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
self.getLoggers = function() {
|
|
606
|
+
return ctx._loggers
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
// /**
|
|
610
|
+
// * Add or override existing level(s)
|
|
611
|
+
// * @param {object} levels
|
|
612
|
+
// * */
|
|
613
|
+
// self.addLevel = function(levels) {
|
|
614
|
+
// for (var l in levels) {
|
|
615
|
+
// self[l] = new Function('return '+write+'('+JSON.stringify(opt)+', "'+l+'", arguments);');
|
|
616
|
+
// }
|
|
617
|
+
// }
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* <console>.setLevel
|
|
621
|
+
* Define a level for a given application
|
|
622
|
+
*
|
|
623
|
+
* @param {string} level hierarchy
|
|
624
|
+
* @param {string} group - existing application or service
|
|
625
|
+
* @returns
|
|
626
|
+
*/
|
|
627
|
+
self.setLevel = function(level, group) {
|
|
628
|
+
if ( typeof(group) == 'undefined' || /^gina\-/.test(group) ) {
|
|
629
|
+
group = 'gina'
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
var opt = loggers[group]._options;
|
|
633
|
+
level = level.toLowerCase();
|
|
634
|
+
if ( typeof(opt.hierarchies[level]) == 'undefined' ) {
|
|
635
|
+
console.warn('`'+ level +'` is not a valid level: swithcing to `info`');
|
|
636
|
+
level = 'info';
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
opt.name = group;
|
|
640
|
+
process.env.LOG_GROUP = group;
|
|
641
|
+
opt.hierarchy = level;
|
|
642
|
+
process.env.LOG_LEVEL = level;
|
|
643
|
+
|
|
644
|
+
setColors(group);
|
|
645
|
+
setDefaultLevels(group);
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
self.debug('Log level set for `'+ group +'`: '+ level);
|
|
649
|
+
|
|
650
|
+
return
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
self.pauseReporting = function() {
|
|
654
|
+
loggers[ctx._options.name]._options.isReporting = false;
|
|
655
|
+
}
|
|
656
|
+
self.resumeReporting = function() {
|
|
657
|
+
loggers[ctx._options.name]._options.isReporting = true;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
// Might be overkill ...
|
|
663
|
+
// TODO - <console>.filterLoggerByGroup('myApp')
|
|
664
|
+
// => Should log `myApp` only
|
|
665
|
+
// TODO - <console>.filterLoggerByLevel('warn')
|
|
666
|
+
// Should only log
|
|
667
|
+
// self.filterLogger['ByGroup'] = function(group) {
|
|
668
|
+
// console.debug('Getting `'+ group +'` logger');
|
|
669
|
+
// }
|
|
670
|
+
|
|
671
|
+
self.log = function() {
|
|
672
|
+
var opt = self.getOptions();
|
|
673
|
+
var args = arguments, content = '';
|
|
674
|
+
|
|
675
|
+
//To handle logs with coma separated arguments.
|
|
676
|
+
for (let i=0; i<args.length; ++i) {
|
|
677
|
+
|
|
678
|
+
if (args[i] instanceof Object) {
|
|
679
|
+
//console.log("\n...", args[i], args[i].toString());
|
|
680
|
+
content += JSON.stringify(args[i], null, '\t');
|
|
681
|
+
} else {
|
|
682
|
+
content += args[i];
|
|
683
|
+
|
|
684
|
+
// In case of formated entries - eg.: spawned server that is already returning formated logs
|
|
685
|
+
// if ( /(\[|\[\s+)debug/.test(args[i]) ) {
|
|
686
|
+
// // args[i] = args[i].replace(/\n$/, '');
|
|
687
|
+
// // self.debug(args[i].replace(/^.*\[debug.*\]\s+/, '').replace(/\n$/, ''));
|
|
688
|
+
|
|
689
|
+
// emit(opt, 'log', content.replace(/\n$/, ''), true);
|
|
690
|
+
// return;
|
|
691
|
+
|
|
692
|
+
// emit(opt, 'debug', content.replace(/\n$/, ''), true);
|
|
693
|
+
|
|
694
|
+
// for (let p=0, pLen=opt.flows.length; p<pLen; p++) {
|
|
695
|
+
// let container = opt.flows[p];
|
|
696
|
+
// process.emit('logger#'+container, args[i].replace(/\n$/, ''));
|
|
697
|
+
// }
|
|
698
|
+
// // process.stdout.write(content);
|
|
699
|
+
|
|
700
|
+
// continue;
|
|
701
|
+
// }
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
if (content != '') {
|
|
706
|
+
|
|
707
|
+
// intercepte already formated messages
|
|
708
|
+
if ( /^\S\[\d+[m]/.test(content) && /\n$/.test(content) ) {
|
|
709
|
+
emit(opt, 'catch', content, true);
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
// else {
|
|
713
|
+
// for (let i=0, len=opt.flows.length; i<len; i++) {
|
|
714
|
+
// let container = opt.flows[i];
|
|
715
|
+
// process.emit('logger#'+container, content);
|
|
716
|
+
// }
|
|
717
|
+
// }
|
|
718
|
+
|
|
719
|
+
process.stdout.write(content + '\n');
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
return init(opt);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
module.exports = Logger();
|
|
728
|
+
// if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
|
|
729
|
+
// // Publish as node.js module
|
|
730
|
+
// module.exports = Logger();
|
|
731
|
+
// } else if ( typeof(define) === 'function' && define.amd) {
|
|
732
|
+
// // Publish as AMD module
|
|
733
|
+
// define( function() { return Logger() });
|
|
734
|
+
// }
|