mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-15 14:30:22 +00:00
Merge pull request #24135 from cjbarth/winston-syslog
Add typings for winston-syslog
This commit is contained in:
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for winston-syslog 1.0
|
||||
// Project: https://github.com/indexzero/winston-syslog#readme
|
||||
// Definitions by: Chris Barth <https://github.com/cjbarth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as winston from "winston";
|
||||
export interface SyslogTransportOptions extends winston.GenericTextTransportOptions {
|
||||
host?: string;
|
||||
port?: number;
|
||||
path?: string;
|
||||
protocol?: string;
|
||||
pid?: number;
|
||||
facility?: string;
|
||||
localhost?: string;
|
||||
type?: string;
|
||||
app_name?: string;
|
||||
eol?: string;
|
||||
}
|
||||
export class Syslog extends winston.Transport implements winston.TransportInstance {
|
||||
}
|
||||
declare module "winston" {
|
||||
interface Transports {
|
||||
Syslog: Syslog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"winston-syslog-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import winston = require('winston');
|
||||
import { SyslogTransportOptions } from 'winston-syslog';
|
||||
|
||||
const str = "";
|
||||
const bool = true;
|
||||
const num = 1;
|
||||
const obj: any = {};
|
||||
|
||||
const syslogOptions: SyslogTransportOptions = {
|
||||
host: str,
|
||||
port: num,
|
||||
path: str,
|
||||
protocol: str,
|
||||
pid: num,
|
||||
facility: str,
|
||||
localhost: str,
|
||||
type: str,
|
||||
app_name: str,
|
||||
eol: str,
|
||||
json: bool,
|
||||
colorize: bool,
|
||||
colors: str,
|
||||
prettyPrint: bool,
|
||||
showLevel: bool,
|
||||
label: str,
|
||||
depth: num,
|
||||
};
|
||||
|
||||
winston.add(winston.transports.Syslog, syslogOptions);
|
||||
|
||||
const logger: winston.LoggerInstance = new (winston.Logger)({
|
||||
transports: [
|
||||
new (winston.transports.Syslog)(syslogOptions),
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user