This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# fail if any commands fails | |
set -e | |
# debug log | |
set -x | |
echo "starting install" | |
add-apt-repository main | |
add-apt-repository universe | |
add-apt-repository restricted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To configure an external lib like loggly-tracker follow these steps | |
// 1. Either download or in your index.html add areference to a Loggly script | |
// <script type="text/javascript" src="//cloudfront.loggly.com/js/loggly.tracker-2.1.min.js"></script> | |
// 2. In typings.d.ts file declare the Loggly global variable like: | |
// declare var LogglyTracker; | |
// 3. You should be all set to use the LogglyTracker | |
import {BrowserModule} from '@angular/platform-browser'; | |
import {ErrorHandler, Injectable, NgModule} from '@angular/core'; | |
import {AppComponent} from './app.component'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class ErrorLogService { | |
private name: String = 'ErrorLogService'; | |
constructor() { | |
} | |
logError(error: any) { | |
const date = new Date().toISOString(); | |
if (error instanceof HttpErrorResponse) { | |
console.error(date, 'There was an HTTP error.', error.message, 'Status code:', (<HttpErrorResponse>error).status); | |
} else if (error instanceof TypeError) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BrowserModule} from '@angular/platform-browser'; | |
import {ErrorHandler, Injectable, NgModule} from '@angular/core'; | |
import {HttpErrorResponse} from '@angular/common/http'; | |
import {AppComponent} from './app.component'; | |
// Our service to handle errors (ideally in its own file) | |
@Injectable() | |
export class ErrorLogService { | |
private name: String = 'ErrorLogService'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BrowserModule} from '@angular/platform-browser'; | |
import {ErrorHandler, NgModule, Injectable} from '@angular/core'; | |
import {AppComponent} from './app.component'; | |
@Injectable() | |
class UIErrorHandler extends ErrorHandler { | |
constructor() { | |
super(); | |
} | |
handleError(error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BrowserModule} from '@angular/platform-browser'; | |
import {ErrorHandler, NgModule} from '@angular/core'; | |
import {AppComponent} from './app.component'; | |
class MyErrorHandler extends ErrorHandler { | |
constructor() { | |
super(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var bunyan = require('bunyan'); | |
var Bunyan2Loggly = require('bunyan-loggly'); | |
var log = bunyan.createLogger({ | |
name: 'logglylog', | |
streams: [{ | |
type: 'raw', | |
stream: new Bunyan2Loggly({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bunyan = require('bunyan'); | |
const Bunyan2Loggly = require('bunyan-loggly'); | |
const log = bunyan.createLogger({ | |
name: 'logglylog', | |
streams: [ | |
{ | |
type: 'raw', | |
stream: new Bunyan2Loggly({ | |
token: '<your token>', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
[ | |
"env", | |
{ | |
"targets": { | |
"node": 4 | |
} | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run npm i loggly --save | |
import * as loggly from 'node-loggly-bulk'; | |
interface LoggingClient { | |
log(obj: any, cb:Function): any | |
} | |
const client: LoggingClient = loggly.createClient({ | |
token: 'YOUR_APPLICATION_TOKEN', | |
subdomain: 'YOUR_SUBDOMAIN', | |
json: true |
NewerOlder