mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 04:25:39 +01:00
Add fluentd
This commit is contained in:
parent
3bca3ef072
commit
f4d52fcd98
4 changed files with 26 additions and 1 deletions
11
lib/logger.js
Normal file
11
lib/logger.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { FluentClient } from '@fluent-org/logger';
|
||||
const logger = new FluentClient(process.env.FLUENT_TAG_PREFIX, {
|
||||
socket: {
|
||||
host: process.env.FLUENTD_HOST,
|
||||
port: process.env.FLUENTD_PORT,
|
||||
|
||||
timeout: 3000, // 3 seconds
|
||||
},
|
||||
});
|
||||
|
||||
export default logger;
|
||||
|
|
@ -12,6 +12,7 @@ import {
|
|||
LAPTOP_SCREEN_WIDTH,
|
||||
MOBILE_SCREEN_WIDTH,
|
||||
} from './constants';
|
||||
import logger from './logger';
|
||||
|
||||
let lookup;
|
||||
|
||||
|
|
@ -75,7 +76,7 @@ export async function getCountry(req, ip) {
|
|||
|
||||
const result = lookup.get(ip);
|
||||
|
||||
console.log(JSON.stringify(result));
|
||||
logger.emit('getCountry', { result });
|
||||
|
||||
return result?.country?.iso_code;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue