Skip to content

Commit

Permalink
No longer log to loggly
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Sep 18, 2023
1 parent 6f614e6 commit 2f9484e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 61 deletions.
2 changes: 1 addition & 1 deletion node-src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function run({
}): Promise<Output> {
const sessionId = uuid();
const env = getEnv();
const log = createLogger(sessionId, env);
const log = createLogger(env);

const pkgInfo = await readPkgUp({ cwd: process.cwd() });
if (!pkgInfo) {
Expand Down
13 changes: 1 addition & 12 deletions node-src/lib/log.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable no-console */
import debug from 'debug';
import nlb from 'node-loggly-bulk/lib/loggly/client';
import stripAnsi from 'strip-ansi';
import { format } from 'util';

Expand Down Expand Up @@ -39,21 +38,14 @@ export interface Logger {
setInteractive: (value: boolean) => void;
}

export const createLogger = (sessionId, env) => {
export const createLogger = (env) => {
let level = (LOG_LEVEL.toLowerCase() as keyof typeof LOG_LEVELS) || DEFAULT_LEVEL;
if (DISABLE_LOGGING === 'true') level = 'silent';

let interactive = !process.argv.slice(2).includes('--no-interactive');
let enqueue = false;
const queue = [];

const logglyClient = nlb.createClient({
token: env.LOGGLY_CUSTOMER_TOKEN,
subdomain: 'hichroma',
tags: ['chromatic-cli'],
json: true,
});

const log =
(type: LogType) =>
(...args) => {
Expand All @@ -66,9 +58,6 @@ export const createLogger = (sessionId, env) => {
// Queue up the logs or print them right away
if (enqueue) queue.push({ type, messages });
else console[type](...messages);

// Also send logs to Loggly
logglyClient.log(messages.map((msg) => ({ sessionId, msg })));
};

const logger: Logger = {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@
"no-proxy": "^1.0.3",
"node-ask": "^1.0.1",
"node-fetch": "3.2.10",
"node-loggly-bulk": "^4.0.1",
"npm-run-all": "^4.0.2",
"observable": "^2.1.4",
"os-browserify": "^0.3.0",
Expand Down
47 changes: 0 additions & 47 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5055,15 +5055,6 @@ axe-core@^4.0.2:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.3.3.tgz#b55cd8e8ddf659fe89b064680e1c6a4dceab0325"
integrity sha512-/lqqLAmuIPi79WYfRpy2i8z+x+vxU3zX2uAm0gs1q52qTuKwolOj1P8XbufpXcsydrpKx2yGn2wzAnxCMV86QA==

axios@1.3.4:
version "1.3.4"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.3.4.tgz#f5760cefd9cfb51fd2481acf88c05f67c4523024"
integrity sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"

axobject-query@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
Expand Down Expand Up @@ -8139,11 +8130,6 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"

follow-redirects@^1.15.0:
version "1.15.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==

for-each@^0.3.3:
version "0.3.3"
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
Expand Down Expand Up @@ -8205,15 +8191,6 @@ form-data@^3.0.0:
combined-stream "^1.0.8"
mime-types "^2.1.12"

form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"

format@^0.2.0:
version "0.2.2"
resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b"
Expand Down Expand Up @@ -10334,11 +10311,6 @@ json-stable-stringify-without-jsonify@^1.0.1:
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=

json-stringify-safe@5.0.x:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=

json5@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
Expand Down Expand Up @@ -11429,11 +11401,6 @@ mock-fs@^5.1.2:
resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-5.1.2.tgz#6fa486e06d00f8793a8d2228de980eff93ce6db7"
integrity sha512-YkjQkdLulFrz0vD4BfNQdQRVmgycXTV7ykuHMlyv+C8WCHazpkiQRDthwa02kSyo8wKnY9wRptHfQLgmf0eR+A==

moment@2.29.4:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==

move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
Expand Down Expand Up @@ -11624,15 +11591,6 @@ node-libs-browser@^2.2.1:
util "^0.11.0"
vm-browserify "^1.0.1"

node-loggly-bulk@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/node-loggly-bulk/-/node-loggly-bulk-4.0.1.tgz#6e3b3adaabaa9ff62f2758cc7dbf6d021f5606e7"
integrity sha512-pVctkicMfJZC2TLFE0AJ7dFzc8vbboxQOS+WIIDGea1GblugHTodBbuxxhSTzLgT3U+NiezvPgWYUbApVvE1xQ==
dependencies:
axios "1.3.4"
json-stringify-safe "5.0.x"
moment "2.29.4"

node-modules-regexp@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40"
Expand Down Expand Up @@ -12743,11 +12701,6 @@ proxy-addr@~2.0.7:
forwarded "0.2.0"
ipaddr.js "1.9.1"

proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

prr@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476"
Expand Down

0 comments on commit 2f9484e

Please sign in to comment.