{"id":23086190,"url":"https://github.com/ajbrown/angular-loggly-logger","last_synced_at":"2025-08-18T15:06:29.210Z","repository":{"id":16581066,"uuid":"19335213","full_name":"ajbrown/angular-loggly-logger","owner":"ajbrown","description":"An AngularJS module which sends your $log message to loggly, and provides a service for manually sending messages to loggly.","archived":false,"fork":false,"pushed_at":"2018-12-03T20:29:18.000Z","size":164,"stargazers_count":32,"open_issues_count":9,"forks_count":47,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-04T12:06:48.225Z","etag":null,"topics":["angular","angularjs","javascript","logging"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"fire855/android_external_sepolicy-mtk","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajbrown.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-01T03:49:32.000Z","updated_at":"2021-06-30T08:55:38.000Z","dependencies_parsed_at":"2022-07-26T05:46:26.757Z","dependency_job_id":null,"html_url":"https://github.com/ajbrown/angular-loggly-logger","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ajbrown/angular-loggly-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajbrown%2Fangular-loggly-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajbrown%2Fangular-loggly-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajbrown%2Fangular-loggly-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajbrown%2Fangular-loggly-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajbrown","download_url":"https://codeload.github.com/ajbrown/angular-loggly-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajbrown%2Fangular-loggly-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270559180,"owners_count":24606682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angularjs","javascript","logging"],"created_at":"2024-12-16T18:42:21.187Z","updated_at":"2025-08-18T15:06:29.166Z","avatar_url":"https://github.com/ajbrown.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.org/ajbrown/angular-loggly-logger.svg)](https://travis-ci.org/ajbrown/angular-loggly-logger)\n[![Coverage Status](https://coveralls.io/repos/ajbrown/angular-loggly-logger/badge.svg?branch=master)](https://coveralls.io/r/ajbrown/angular-loggly-logger?branch=master)\n[![Join the chat at https://gitter.im/ajbrown/angular-loggly-logger](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ajbrown/angular-loggly-logger?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n\nAngular Loggly Logger is a module which will decorate Angular's $log service,\nand provide a `LogglyLogger` service which can be used to manually send messages\nof any kind to the [Loggly](https://www.loggly.com) cloud log management service.\n\n\n### Getting Started\n\nLogglyLogger can be installed with bower:\n\n```\nbower install angular-loggly-logger\n```\n\nOr with npm:\n\n```\nnpm install --save angular-loggly-logger\n```\n\nOnce configured (by including \"logglyLogger\" as a module dependency), the `$log`\nservice will automatically be decorated, and all messages logged will be handled\nas normal as well as formated and passed to LogglyLogger.sendMessage.\nThe plain text messages are sent into the \"json.message\" field with the decorated\nlog while custom JSON objects are sent via \"json.messageObj\" field as Loggly\nonly supports one type per field.\n\nTo use both the decorated $log and the LogglyLogger service, you must first\nconfigure it with an inputToken, which is done via the LogglyLoggerProvider:\n\n```javascript\nangular.module( 'myApp', [require('angular-loggly-logger')] )\n\n  .config([\"LogglyLoggerProvider\", function( LogglyLoggerProvider ) {\n    LogglyLoggerProvider.inputToken( '\u003cloggly input token here\u003e' );\n  } ]);\n\n  .run([\"LogglyLogger\", \"$log\", function( LogglyLogger, $log ) {\n\n    //This will be sent to both the console and Loggly\n    $log.info( \"I'm a little teapot.\" );\n\n    //This will be sent to loggly only\n    LogglyLogger.sendMessage( { message : 'Short and Stout.' } );\n  }])\n\n```\n\n### $log decoration\n\nWhen sent through the `$log` decorator, messages will be formatted as follows:\n\n```javascript\n\n// Example: $log.warn( 'Danger! Danger!' );\n{\n  level: \"WARN\",\n  timestamp: \"2014-05-01T13:10Z\",\n  msg: \"Danger! Danger!\",\n  url: \"https://github.com/ajbrown/angular-loggly-logger/demo/index.html\",\n}\n\n// Example: $log.debug( 'User submitted something:', { foo: 'A.J', bar: 'Space' } )\n\n{\n  level: \"DEBUG\",\n  timestamp: \"2014-05-01T13:18Z\",\n  msg: [\"User submitted something\", { foo: 'A.J.', bar: 'Space' }],\n  url: \"https://github.com/ajbrown/angular-loggly-logger/demo/index.html\",\n}\n```\n\n\u003e However, 'url' and 'timestamp' are not included by default.  You must enable those options in your application config (see below).\n\n\nNote that if you do not call `LogglyLoggerProvider.inputToken()` in a config method, messages will not be sent to loggly.  At the moment, there is no warning -- your message is just ignored.\n\n### Configuration\n\nThe following configuration options are available.\n\n```javascript\n\n  LogglyLoggerProvider\n\n    // set the logging level for messages sent to Loggly.  Default is 'DEBUG',\n    // which will send all log messages.\n    .level( 'DEBUG' )\n\n    // set the token of the loggly input to use.  Must be set, or no logs\n    // will be sent.\n    .inputToken( '\u003cyour-token\u003e' )\n\n    // set whether or not HTTPS should be used for sending messages.  Default\n    // is true\n    .useHttps( true )\n\n    // should the value of $location.absUrl() be sent as a \"url\" key in the\n    // message object that's sent to loggly?  Default is false.\n    .includeUrl( false )\n\n    // should the value of $window.navigator.userAgent be sent as a \"userAgent\" key in the\n    // message object that's sent to loggly?  Default is false.\n    .includeUserAgent( false )\n\n    // should the current timestamp be included? Default is false.\n    .includeTimestamp( false )\n\n    // set comma-seperated tags that should be included with the log events.\n    // Default is \"angular\"\n    .inputTag(\"angular,customTag\")\n\n    // Send console error stack traces to Loggly.  Default is false.\n    .sendConsoleErrors( false )\n\n    // Toggle logging to console.  When set to false, messages will not be\n    // be passed along to the original $log methods.  This makes it easy to\n    // keep sending messages to Loggly in production without also sending them\n    // to the console.   Default is true.\n    .logToConsole( true )\n\n    //Toggle delete other headers. If there are any other headers than Accept\n    //and Content-Type in request, the browser will first send pre-flight OPTIONS\n    //request.\n    //Turn this on if you see HTTP 405 errors in console. \n    .deleteHeaders( false )\n\n    // Custom labels for standard log fields. Use this to customize your log\n    // message format or to shorten your logging payload. All available labels\n    // are listed in this example.\n    .labels({\n      col: 'c',\n      level: 'lvl',\n      line: 'l',\n      logger: 'lgr',\n      message: 'msg',\n      stack: 'stk',\n      timestamp: 'ts',\n      url: 'url',\n      userAgent: 'userAgent'\n    })\n\n```\n\n### Sending JSON Fields\n\nYou can also default some \"extra/default\" information to be sent with each log message.  When this is set, `LogglyLogger`\nwill include the key/values provided with all messages, plus the data to be sent for each specific logging request.\n\n```javascript\n\n  LogglyLoggerProvider.fields( { appVersion: 1.1.0, browser: 'Chrome' } );\n\n  //...\n\n  $log.warn( 'Danger! Danger!' )\n\n  \u003e\u003e { appVersion: 1.1.0, browser: 'Chrome', level: 'WARN', message: 'Danger! Danger', url: 'http://google.com' }\n```\n\nExtra fields can also be added at runtime using the `LogglyLogger` service:\n\n```javascript\n  app.controller( 'MainCtrl', [\"$scope\", \"$log\", \"LogglyLogger\", function( $scope, $log, LogglyLogger ) {\n\n    logglyLogger.fields( { username: \"foobar\" } );\n\n    //...\n\n    $log.info( 'All is good!' );\n\n  \u003e\u003e { appVersion: 1.1.0, browser: 'Chrome', username: 'foobar', level: 'WARN', message: 'All is good', url: 'http://google.com' }\n  }])\n\n```\n\n\nBeware that when using `setExtra` with `LogglyLogger.sendMessage( obj )`, any properties in your `obj` that are the same as your `extra` will be overwritten.  \n\n## ChangeLog\n- v0.2.2 - Fixes preflight cross origin issues.\n- v0.2.3 - Fixes npm install issues related to Bower.\n- v0.2.4 - Adds customizable labels, error stacktraces, and user-agent logging.\n\n\n## Contributing\n\nContributions are awesome, welcomed, and wanted.  Please contribute ideas by [opening a new issue](http://github.com/ajbrown/angular-loggy-logger/issues), or code by creating a new pull request.  Please make sure your pull request targets the \"develop\" branch.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajbrown%2Fangular-loggly-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajbrown%2Fangular-loggly-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajbrown%2Fangular-loggly-logger/lists"}